- Home /
After parent change, rigidbody falls through terrain
I have rigidbody objects in my game that the character can pick up (think ball, book, etc). Before the character picks it up, the rigidbody behaves as expected, it can be pushed around, and fall off objects, but it won't fall through the terrain. However after a character has picked it up and wants to put it down again, it now falls through everything.
When I pick it up, I set isKinematic to true and detectCollisions to false. After, when I'm 'letting go' I set these to false and true respectively. useGravity is always true.
The only other thing that changes, is the parent of the rigidbody. It's normally an empty game object called props unless it's being held by a character then it's parent is the right hand.
I've looked at other rigidbody falls through terrain questions, but nothing I've tried has worked.
What are the rigidbody's settings before you pick it up?
For the ball, for example, it has a sphere collider (isTrigger is not set) and the following rigidbody settings.
$$anonymous$$ass 1
Drag 1
Angular Drag 0.05
Use Gravity = true
Is $$anonymous$$inematic = false
Interpolate = none
Collision Detection = continuous
none of the freeze constraints are set
This beats me...Probably your right hand parent object is changing some variables to all the children... Do you parent the ball back to the empty game object? Do its settings change back as you set them up?
Yep, it gets parented back to the empty game object. When I watch the settings, they are all 'correct' afterwards (ie identical to those above). I've tried playing around with the settings before picking it up, to see if I could get the objects to fall through the ground, but no luck.
I've also tried looking at the velocity - in case something odd was set to send it through the ground too fast - but both velocity and angular velocity are (0,0,0).
I tried to reproduce this yesterday, and could not make it happen. In my attempt I had issues with the object sleeping, but since your object is falling, that is not the issue. Try disabling/enabling the collider rather than setting detectCollisions.
Your answer
Follow this Question
Related Questions
How to make a deform on a terrain with the points on a collision of rigidbody 0 Answers
Player's Rigidbody slides up terrain walls 1 Answer
Object Flies into Air Upon Collision, or goes through hill depending on isKinematic settings 1 Answer
Terrain collider failing in unity 5/17? 1 Answer
Rigidbody falling trough terrain 2 Answers