これは1週間ほどの間問題となっています。私はそれを把握していないようだ。私は、逆さまになると私の潜水艦をそのy軸上で反転しようとしています。マウスの位置で回転します。c#ユニティエラーは、私の潜水艦をy軸上に回転させることができません
このコードは私の潜水艦をマウスの位置で回転させますが、これは完璧です。
Vector3 RayPos = cam.WorldToScreenPoint(transform.position);
Vector3 dir = Input.mousePosition - RayPos;
float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation,
rotateSpeed * Time.deltaTime);[sub flipping y][1]
このコードは私の問題です。私のサブが逆さまになると、それは反転する(y)が、 それは一度だけそれをやり直し、正しい方法でそれを反転させないと、 はもう(y)になります。
Debug.Log(Mathf.Abs(Vector3.Dot(transform.up, Vector3.up)));
if (Mathf.Abs(Vector3.Dot(transform.up, Vector3.down)) < 0.125f)
{
if (Mathf.Abs(Vector3.Dot(transform.right, Vector3.down)) > 0.825f)
{
SubTrans.localScale = new Vector3(transform.localScale.x, -1,
transform.localScale.z);
}
else
{
SubTrans.localScale = new Vector3(transform.localScale.x, 1,
transform.localScale.z);
}
}
この質問は2回目です。あなたの問題を理解することが難しいので、答えが得られていません。たぶんあなたは問題がどのように見えるのアニメーションgifを表示する必要があります。 – Programmer