Question by
Orbayd · Feb 11, 2016 at 11:54 AM ·
cameracamera-lookcamera rotation
Way to rotate Camera with standart Vectors(forward,right, up)
Hello everyone ,Is there any way to rotate camera using right up and forward vectors?
I usually set forward vector and correct other vector using Cross product but it seems nothing changes even i set something to forward, up and right vectors.
public void SetOrientation(Vector3 lookat, Vector3 up, Vector3 pos)
{
Vector3 forward = (pos - lookat).normalized;
Vector3 right = (Vector3.Cross(new Vector3(0.0f,1.0f,0.0f),forward ) ).normalized;
Vector3 up = Vector3.Cross(forward, right).normalized;
this.transform.forward = forward;
this.transform.right = right;
this.transform.up = up;
this.transform.position = pos
}
Best Regards.
Comment