Search code examples
c#vectorunity-game-engineeuler-angles

A point in 3D space from an angle


I'm currently working on a camera for a game. But I got stuck at the rotation.

When I move my mouse across the x- or y-axis, I want the camera to rotate around my character.

What would be a formula to calculate this vector, if the distance to the character is always the same?

I am doing this in Unity, with C#, if this is of any help.


Solution

  • this function may help: transform.RotateAround(Vector3 axis, float degree) you can read the Unity Script Reference for more info.

    -oh and I think you should tag your next questions with "unity3d" but you get the best Unity3d-help at UnityAnswers-Forum http://answers.unity3d.com/index.html.