Having a character Controller have physics..

I have a player made from the standard character controller, all I want is for him to be able to bump into stuff, and knock it about…
If I add a cube and give it a rigid body… I would expect that to work… but no.

As the character controller is the built in Unity controller i would expect it to work with physics. Obviously not, any clues as to what I might try?

Please dont say, “write your own” because if I could I would… just explain me the concept, Ill figure it out!

:slight_smile:

Mark

character controller isn’t affected by physics because it’s not desired. We don’t want the player to bounce and then fall over when he runs into a wall. Instead we want it’s behaviour to be completely programmed.

A character controller is basically a kinematic rigid body that comes with some nice features like stepping stairs. It’s been made as a solution for characters because
a)gamephysics are not real physics, we just do some limited simulation for a few fancy tricks
b)people are not rigidbodys, so we can’t really emulate their behaviour with a rigid body simulation (for example we don’t accelerate or deaccelarte like a rigid body sphere does)

When doing a character you can either:
1.Make a character controller and code all the physics-like behaviour you want (like getting pushed around by an exploding mine, falling down etc.)
2.Make a rigidbody and try to filter out all the behaviour you don’t want

I def prefer controller over rigidbody for player characters, to make sure we’ve got complete control, so that we never get stuck in walls and controls never react awkwardly. People argue over what to choose, you can def go both ways but I found the arguments for controllers convincing. For NPCs there’s more liberty, you can do some funky stuff with rigid bodys, especially with joints, like them wildly flying around when they get shot etc.

There are probably tons of controllerscripts in the unify-wiki.

+Check out the Physics part in the manual.

Hi, this is an old question, but still, I’ll write my opinion, if anyone ever bumps into this question.

First of all, I’m new to Unity, and am trying to learn what I can about rigidbodies and character controllers. But you could change your character from character controller to rigidbody and program it’s movements. That way, when you bump into something which is also a rigidbody, it’ll bounce off naturally.

If you don’t want that, you can (I’m not sure if this will work) detect the collision through script then use Rigidbody.AddForce(), but that would be a pain, since 1) I don’t know if you can detect collisions between character controller and rigidbody, 2) You would have to do that to every object in the game, which is not viable, 3) The force you’d have to apply would depend on the character’s speed. Please correct me if I’m wrong, since I’m new to Unity.

Overall, I’d reccomend you use rigidbody on your character, instead of character controller. Most of the physics calculations are made for you.

If you want to push Rigidbodies or objects with the Character Controller, you can apply forces to any object that it collides with via the OnControllerColliderHit() function through scripting.

This is a direct quote from the Character Controller information page on this site: