- Home /
Eject Overlapping Bodies Without velocity
I'm working on a ragdoll system when a character dies.
If I turn off a rigidbody's isKinematic property when it's already penetrating geo, the body is ejected with velocity from the geo. Obviously, I do want the collision to be solved, but I'd rather the rigidbody be placed nicely outside of the geo rather than flinging it out. Can this be accomplished?
Answer by aldonaletto · Mar 31, 2012 at 02:16 AM
Do you mean "turn off isKinematic"? A rigidbody ignore physics when isKinematic is true, and return to physics control when it's set to false.
Anyway, the problem you've mentioned is probably the "penetration penalty force", a repulsion force applied to the penetrating rigidbody.
You could use a simple script to limit the rigidbody velocity:
var limVel = 0.1;
function FixedUpdate () { if (!rigidbody.isKinematic){ rigidbody.velocity = Vector3.ClampMagnitude(rigidbody.velocity, limVel); } } You can set limVel to some high value (say, 100) to disable the velocity limit, if you want to restore regular behaviour.
Answer by rutter · Mar 31, 2012 at 02:17 AM
Haven't tried it, but maybe you could catch this with OnCollisionExit()
?
Your answer
Follow this Question
Related Questions
How to disable Rigidbody component completely 6 Answers
Activate physics when animation ends 0 Answers
Animation State is causing ragdoll to freeze 0 Answers
Ragdoll driven game 1 Answer