Best Strategy to interact with rigidbody

I am experimenting with building a game which has two main requirements:

  1. A playable character which moves as with a character controller (quick acceleration and sudden stops, quick turns, no gravity effect, etc.)
  2. The ability to interact with object using realistic physics that make the most sense with a rigid body (for example, my character runs into a box and pushes it off of a shelf onto an enemy below).

So my question is: what is the best strategy for building a game with the best of both worlds? If I want to use a character controller on my character, and a rigid body on my box, how can I make a man hit the box and knock it off? It appears that the rigid body and CC just don’t work together - so what combination DOES work?

And also, I’m aware that the simple task of pushing a box off of a ledge would be fairly easy if I coded it by hand, but I’m looking for realistic physics and also interaction with a wide variety of environmental items, so coming up with a way to hard-code transforms for everything in the game without physics just won’t cut it.

2 Answers

2

I found the solution to my own problem.

That page shows how to use the OnControllerCollider method of the CharacterController. The method detects a hit against a rigid body and defines the direction in which the box ought to be pushed.

Vega’s answer (while appreciated) is not correct.

How is it not correct exactly?

This helped me thanks!