x


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

more ▼

asked Dec 22 '10 at 11:02 AM

greg horn gravatar image

greg horn
22 3 3 5

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.)

more ▼

answered Dec 22 '10 at 02:19 PM

runevision gravatar image

runevision ♦♦
8.1k 29 46 112

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

Dec 25 '10 at 12:58 PM greg horn

transform.up and transform.right definitely exist. It's documented here: http://unity3d.com/support/documentation/ScriptReference/Transform-right.html

Dec 29 '10 at 10:36 AM runevision ♦♦
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x461
x98
x69
x10
x7

asked: Dec 22 '10 at 11:02 AM

Seen: 1347 times

Last Updated: Dec 22 '10 at 11:02 AM