V
V
varp52020-12-27 00:37:58
Unity
varp5, 2020-12-27 00:37:58

How to make it so that when rotated, the object does not climb over the texture?

Part of the script that rotates the object:

float AngleRotate = RotateSpeed ​​* Input.GetAxis("MoveTower");
rot.z = Mathf.Clamp( rot.z + AngleRotate, -yLimit, yLimit);
Tower.transform.eulerAngles = rot;
I made this code the gun is placed vertically, I can’t understand why and how can I fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2020-12-27
@varp5

float AngleRotate = Time.deltaTime * RotateSpeed * Input.GetAxis("MoveTower");
AngleRotate = Mathf.Clamp(AngleRotate, MIN, MAX);
Tower.transform.Rotate(0, 0, AngleRotate);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question