I am controlling my character with a basic Rigidbody component, a capsule Collider, a simple bot control script and an Anim Triggers script. My camera is at a 3rd person view. When I run into an object. My character just runs right through it. And when I add a Rigidbody component to the object itself. Then my character pushes the object. How do I get the object to NOT move and my character to NOT go through it?
I would try making the mass of your object very large in comparison to the character. Hope this helps.
There can be a few things wrong here:
- You might have your character set to isKinematic. if you do this, then the object will not be effected by forces and this includes the force that keeps you from running through objects
- You might not have a collider on the object you a re running through. Both objects need a collider for a collision to take place.
- You might be moving so quickly that you are experiencing a frame miss. This is when ou or on one side of the colliding object in one frame and the other side in the next frame. The default collision only checks at frame position so you would miss the colliion. The solution is to set your moving object’s Rigid Body Collision Detction mode to Continuos or Continuos Dynamic. More information on that is here: Unity - Scripting API: CollisionDetectionMode
Note that Continuos collision will chew into your frame rate, Continuoss Dynamic will do so even worse.