- Home /
How do you make gravity for the First Person Controller
I made a First Person Controller,that was set to a height to drop from. Instead of falling the character stayed in the air at the height. It wouldn't go up or down when coming to hills. How do I create a gravity field for this character?
Answer by IJM · Oct 31, 2010 at 08:48 PM
You need to add a Rigidbody Component to your GameObject:
Select your First Person Controller GameObject from the Hierarchy.
In the Menubar go to Component->Physics->Rigidbody
A rigidbody won't work unless asker first removes the character controller from the object in question.
Answer by JesusChristChangedMe · Nov 04, 2010 at 11:12 PM
use this script on this site for basic player movement. click here to go to the site.
hope this helps with your player's movement.
Answer by JesusChristChangedMe · Oct 31, 2010 at 09:22 PM
well instead of a rigidbody i would put a CharacterController on your player.
its right next to the rigidbody. Component->Phisics->CharacterController
but there should be a first person controller prefab already Pre-Put into unity. just search it in the project bar.
As you can see from his question. he's already using a first person controller.
he said he made one. unity already comes with a pre-made one.
I don't think the pre-made controller handles gravity, does it?
yeah it does accually, not only do the scripts it comes with apply gravity to it but so does the character controller. rigidbody is used to make things act like they are bouncing around or falling apart and is used to put on gameObjects. character controller works with lots of moving around scripts. the pre-put in FPS comes with FPSwalker and mouse look scripts.
@UnityScripter: Hmm... you're right: the First Person Controller prefab does indeed handle gravity for you, and the standard CharacterController's Simple$$anonymous$$ove() function does so as well. The problem with the Simple$$anonymous$$ove() function is that you can't do things like jumps through it since it ignores any velocities along the Y axis. As for the First Person Controller pre-fab, maybe asker wants something different?
Your answer
![](https://koobas.hobune.stream/wayback/20220613081506im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Affecting FPS controller/Character Motor physics with game object 1 Answer
FPS's Capsule Collider doesn't work when the FPS is translated. 0 Answers
Attaching First Person Controller to Kinematic Rigidbody 1 Answer
walking inside curved surface 1 Answer
gravity doesnt seem to effect my first person controller....help! 1 Answer