- Home /
Character Controller collision with Rigidbody problem
My Player uses the Character Controller to move around, and the Tree has a Rigidbody with a box collider.
When I wait for the Tree to fall to the ground Player cannot move it (which is intended). Video of Tree 1
But as the Tree falls and you bump into it, the Tree gets pushed rather quickly and feels like it weighs only 1 gram, any thoughts on why this is happening? Video of Tree 2
Answer by NathoSteveo · Jan 13, 2021 at 03:49 AM
Thanks for the reply @MSavioti after some tweaking I managed to fix the problem by disabling players collision detection while tree is falling. was as simple as this haha
private void TreeMovementCheck()
{
if (!treeLogRigid.IsSleeping())
{
playerController.characterController.detectCollision = false;
}
if (treeLogRigid.IsSleeping())
{
playerController.characterController.detectCollisions = true;
}
}
Answer by MSavioti · Jan 13, 2021 at 02:44 AM
I'll give a bunch of suggestions:
Increase the falling tree's rigidbody mass generously.
Changing the physics layer when it's falling so it no long interacts with the player (then change it back when it's on the ground and set its rigidbody type to static).
Prevent player movement if its next position overlaps with the tree's collider.
Your answer
Follow this Question
Related Questions
Character pushes a cart. How to prevent cart from clipping? 0 Answers
Aircraft Control 1 Answer
Move Character Controller 0 Answers
Collisions when pushing object 1 Answer
Rigidbody step offset 1 Answer