gravity doesnt seem to effect my first person controller....help!

hey guys im fairly new to this and need help.. iv got my gravity working on rigid objects (ie everything but my controller) but just cant seem to make it affect me...

also if anyone has a jump script (to make my controller jump) it would be awesome!

Thanks Bowen

1 Answer

1

From the Unity documentation:

"CharacterController allows you to easily do movement constrained by collisions without having to deal with a rigidbody. A CharacterController is not affected by forces and will only move when you call the Move funtion. It will then carry out the movement but be constrained by collisions."

If you're using the Standard Assets / Character Controllers / First Person Controller prefab, it should've come with a Character Motor (Script) component. Two of the benefits of that script are that it handles gravity and jumping. You can modify its properties in the Unity inspector to tell it how strong you want gravity to be and how high you want your character to jump.

Alternatively, if you want your character fully subjected to physics, consider using a RigidBody instead of a CharacterController, although that's usually not the effect you want.

Did you try playing with the "Gravity" property I mentioned?

If you know there's more than one renderer, then you can use Object.GetComponents<Renderer> and iterate through them, depending on what you want to achieve.