|
I'm using a FPS script for general navigation, but also have a 'tour' script which moves my player (and cam) around to some pre-defined views. In doing so, sometimes a 'roll' angle is introduced (for the nice view). When the user moves the player (say, with mouselook or WASD), I want to remove any 'roll' that might have been introduced, leaving just pitch and yaw. Any ideas the best way to do this?
(comments are locked)
|
|
You can apply a corrective rotation that aligns the object's up vector with the world up vector. This can be easily done in Unity using Quaternion.FromToRotation(). That said, an even easier solution would be to use a control scheme that doesn't introduce perceived roll in the first place. (I don't know what control scheme you're using currently, so I can't be much more specific than that.) [Edit: Adding additional info following comments.] Here is what I'd probably try:
I haven't actually tried the above myself, so it's somewhat speculative. But, it's probably what I'd try first. I think he is saying that the 'tour' scripts, from which the player sometimes resumes control, can introduce a roll rotation
Nov 15 '10 at 11:33 PM
Novodantis 1
Correct. Basically I place a bunch of 'dummy' cameras which provide various useful and nice views of the scene. On command, I 'fly' the player using a type of SLERP to match one of those cameras. Sometimes there is a tilt involved because it just looks better. When they hit W or move mouse (for example), I need to upright the camera, not change pitch or yaw though, so it picks up pretty much where the 'tour view' left off, but without the tilt/roll that makes it look lame.
Nov 15 '10 at 11:57 PM
DaveA
I edited my answer and added some additional info.
Nov 16 '10 at 04:43 AM
Jesse Anders
(comments are locked)
|
