Home > other >  Novice, unity3d camera rotation
Novice, unity3d camera rotation

Time:09-16

Cameras with rotateAround revolve around role,
But when the roles of mobile, the camera can't revolve around role,

Below is the code
X=Input. GetAxis (Mouse "x") * rotateSpeed;
Y=Input. GetAxis (Mouse "y") * rotateSpeed;
The transform. RotateAround (target. The position, Vector3. Up, x);
Transform. RotateAround (target. The position, the transform. Right, y);

Vector3 newPos=target. The position + Vector3. Up * 1.3 f - target. Forward * 1.7 f;
The transform. The position=Vector3. Lerp (newPos transform. The position, Time. DeltaTime * 2 f);