Advertisement Jump to content

Character Controller - Rigidbody vs Kinematics

Recommended Posts

This is a general question about player controller on a surface that contains geometry (curved roads / slopes, mountains, etc.) and obstacles (walls). The game should simulate a simple physical model (acceleration, collisions, etc.) and the character should navigate convincingly through the terrain. 

I'm using Unity but I think this is a general question about how to design a character controller.

I wrote a simple character controller that uses player input to steer the character in the world. wasd keys move forward and turn. Since I'm controlling the character directly, I'm using a kinematic object (I don't even use the rigidbody) and moves it by setting the transform directly to some model I implemented (I have speed, acceleration, mass, etc.)

Why did I wrote a physical kinematic simulation? I tried to use a rigidbody and apply forces based on player's input directly on it but I found the control felt a little bit "swimmy" and it was hard to tweak (example: the character slammed hard and spun out of control (even when locking xz rotating direction), it took a long time to accelerate, etc.)

That worked well when during prototyping on a simple plane with no obstacles. Now I have a level with non-even geometry. The problem I have is how to make the players "stick" to the ground when they travel around (Prototype applies movement on the xz plane but doesn't take into account being connected to the floor). Another issue is to set the orientation (up vector) of the player (imagine a vehicle) in a way that looks both smooth and convincing - the vehicle should change its pitch / roll as it's navigating through some slopes. Even the simple example of a  vehicle starting to climb from a plane on a road with a constant slop (say 20 deg) should change the orientation in a convincing manner, i.e. the vehicle should not start to "lift the nose" before touching the ramp, nor should it "sink the nose" colliding into the ramp. Again, this is where the physical engine can come in handy, but when I tried to apply force going up the vehicle slowed down because of friction.

I also have problems with collisions since I'm moving the character directly by controlling its transform (kinematic), it feels weird and doesn't play well when the physics engine detects collisions and doesn't want to let the character penetrate a wall. It collides well with objects, it just feel very not natural.

The real questions here are about best approaches to design a character controller (note: that SHOULD be applied also to agents using AI steering algorithms - that also calculates forces or running a model underneath). 

1. How do you move a character? Are you using the physics engine to do the heavy lifting or you control the character directly like a kinematic object?
2. If you're using physics, what's the best approach to apply forces? (yes, it depends on the game, but let's say some realistic based physics model with accelerations and forces - let's assume animations don't apply root motion - to simplify) In Unity, there are multiple ways to apply force - relative / non-relative, impulse / continuous etc.
3, If you're not using physics, how do you make sure that collision detection play nice with your movement algorithms? How do you make collisions look natural and still give the player good control?
4. Uneven terrain, how do you make the character (let's assume a vehicle - a car - with no complex animations (so no IK in play)) "stick" to the ground while changing its orientation (up vector) in a smooth and convincing manner?
5. what's the best way to also allow the player to disconnect from the ground? (e.g. either jump or fall off platforms)

For me, rigidbody vs. kinematic is the key question here. I saw tutorials that use both - but since they were super simple they didn't deal with the problems I mentioned above in depth. I'm wondering what's the best approach for the player controller and would love to hear more points to consider and tips based on your experience. Pseudo code / code samples (in any language / engine) would be much appreciated. Thank you!

Edited by iradicator

Share this post

Link to post
Share on other sites

I'd personally advise against doing DCC (Dynamic character controller) unless you have very good game design reasons for it. Implementing KCC (Kinematic character controller) is just better at representing characters in general.

Generally - a character, like animal or human - shouldn't be handled as physics body (by applying friction & forces).

EDIT: To answer questions:

1. I'm using KCC for generic characters (e.g. human or animals) - always pushing the body around

2. I've used physics only in case of special physics characters (like using a rolling ball attempting not to fall down from obstacles you're rolling on - this is one case of the games where using DCC is viable and part of game design

3. Tricky question - this may depend on actual implementation. When was the time I had no physics engine available - I used simple ray casting and sliding along the walls (like in Quake/Half Life). So you couldn't lag in the wall... Same approach can actually be used with any current engine - ODE, Bullet, PhysX, etc.

In short - if your character movement doesn't feel natural - you're doing something wrong here.

4. F.e. for car I actually use a car-like physics (as dynamic physics object) - there are 2 models used - either raycasts for wheels + rigid body (simple vehicle) or more complex simulation involving actual motor, wheels (as 'cylinders' F.e.), and rigid body jointed to them.

Why would character change up vector orientation on terrain (unless it's spherical, where it always points away from center of the planet)?

5. Set vertical velocity.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!