0 votes
asked in General Help by (310 points)

Hi Partel,

I have a disconnect muscle bit of code that checks breakforce, and depending if breakfoce is not infinity, I disconnect the muscle using:

broadcaster.puppetMaster.DisconnectMuscleRecursive(broadcaster.muscleIndex, MuscleDisconnectMode.Sever);

The issue I am facing is that when I hit the character hard, it sometimes disconnects the muscle and removed the character joint component, the muscle collision broadcaster component (script) and the joint break broadcaster component (script).  It also unparents the limb from the character hierarchy.  The other thing I have noticed is that under the puppetmaster gameobject, the missing limb (in this case foot),  has also been removed from the individual muscle settings (regular character has 15 muscles, now it has 14).  This only happens sometimes (most annoying thing to track)

I am hoping you have come across this before.



1 Answer

0 votes
answered by (24.4k points)

Please do not use joint.breakForce for dismemberment. Unity will destroy the joint so PM will have to remove it completely instead of disconnecting it.

Instead, you can check joint.currentForce/currentTorque in FixedUpdate and if their sqrMagnitude is above a threshold, call PuppetMaster.DisconnectMuscleRecursive.

Welcome to RootMotion Q&A, where you can ask questions and receive answers from the developer of Final IK and PuppetMaster and other members of the community.

Post as a guest, create an account or login via Facebook.

Please use the correct category when you post your questions.