|
Hi, I was trying to make a camera rotate like while using MouseLook script in the standard assert and I want a player can press a button to snap( LookAt ) a target in screen(First person view) while using MouseLook. The problem is the MouseLook Script use quatenion to rotate in the following script Code:
and I try to use Code:
The thing that happen was my camera lookat target but the MouseLook still use the rotationX and rotationY that sum from before and try to wrap my camera back to where it was before using LookAt. I know this would be a newbie question but How can I do this to make it get along together? Thank you
(comments are locked)
|
|
Just after you use FPSCamera.transform.LookAt(target)*, you need to get the resultant rotationX and rotationY from the rotation you've forced, i.e. if you got the camera to look forward, then next time around, rotationX needs be 0, and so does rotationY... otherwise you're just setting the angles back to what the rotationX/Y is, which only gets changed by input, and not by whatever is doing your view snapping. So I guess that you'd add something like
(comments are locked)
|
|
Maybe obvious, but what happens if you fix the typo ("tranform") to this: FPSCamera.transform.LookAt(target);
(comments are locked)
|
