- Home /
Implementing FPS view into locomotion planet walk
Hi
I've been looking for solutions to be able to walk on spheres without falling down, and I stumbled onto the locomotion scripts which pretty much allow exactly this:
http://www.scottpetrovic.com/blog/20...ystem-wsource/
The character is not falling off the sphere, and the camera makes the sphere ground always appear below the player, which is just what I'm looking for. However, in my project I use a first-person view and regular first-person movement control. I assume it should be easier than the standard scripts, as no 3rd person camera movements and smoothing are required. I'm trying to modify the scripts, but I'm rather new to it and I haven't managed to get anything working. I'd greatly appreciate some help, maybe if anyone could provide me with a modified example scene where a fps view was integrated!
Regards,
greg
Answer by runevision · Dec 22, 2010 at 02:19 PM
This should be rather straightforward:
Make the camera a child of the character and move it to the position you want it to be at (like around the head).
Use a MouseLook script from standard assets or from the UnifyWiki (like this one) - with a small modification:
Instead of rotating around Vector3.up and Vector3.right, rotate around transform.up and transform.right. (Note that Vector3.left (a deprecated variable) is the same as -Vector3.right.)
Thanks, the attachment part worked! However, I'm having trouble modifying the mouselook script. When I replace Vector3.up and Vector3.right with transform.up and transform.right, unity concole tells me it doesn't know these commands?
Regards,
greg
transform.up and transform.right definitely exist. It's documented here: http://unity3d.com/support/documentation/ScriptReference/Transform-right.html