V
V
vania932015-01-13 05:29:11
3D
vania93, 2015-01-13 05:29:11

How to make camera rotation in unity3d?

Good day
unity3d I'm studying recently and the question arose
How to make the camera rotate from a third person?
for clarity, I want to do it like here solarsystemscope.com
so that you can rotate around the object
along the X axis, it rotates normally,
but if I start rotating along the Y axis, I get chaos
of information about this, I could not find it because I don’t know what this type of camera is called correctly

if (Input.GetKey (KeyCode.D)) {
      transform.RotateAround (new Vector3 (0, 0, 0), new  Vector3 (0, -2, 0), 100 * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.A)) {
      transform.RotateAround (new Vector3 (0, 0, 0), new  Vector3 (0, 2, 0), 100 * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.W)) {
      transform.RotateAround (new Vector3 (0, 0, 0), new  Vector3 (2, 0, 0), 100 * Time.deltaTime);
    }
    if (Input.GetKey (KeyCode.S)) {
      transform.RotateAround (new Vector3 (0, 0, 0), new  Vector3 (-2, 0, 0), 100 * Time.deltaTime);
    }

here is the code that I wrote
for the test, put control on the keys
, where can I find information about how to make such a camera and what is it called?
thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SHVV, 2015-01-13
@vania93

Don't do that, use Euler angles.

T
Taras Fomin, 2015-01-16
@Tarik02

Insert a rotateY container, and insert a camera into its rotateX and rotateX , then rotate rotateY along the Y axis, and the other, respectively.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question