0 votes
asked in General Help by (150 points)

Hi, so I was continuing working on the enemy character that is able to remove muscles from it (http://root-motion.com/qa/index.php?qa=2898&qa_1=removing-muscle-from-character-that-both-puppetmaster-final) so I decided to add prop for it to carry so that it can attack the players using the prop it is holding.

The problem rises when the enemy gets his hand muscle removed while the hand holds a prop, using the RemoveMuscleRecursive function. I am using object pooling so the enemy will get rebuild using the puppetmaster.rebuild() function to prepare it for its next run which I will provide it with another set of props to hold. I receive the error message of Null Reference Exception at line 70 of PuppetMasterHierarchyAPI.cs, which was traced from line 90 of Prop Root. There is a warning message before the error message which says "No muscle with Rigidbody Wrist_Rfound on the PuppetMaster", which comes from lines 201 of PuppetMasterMuscleAPI.cs.

My assumption would be breaking the hand/arm of the puppetmaster did manage to remove it properly but when I rebuild it it does not do so correctly as it was connected to a prop previously, as my new prop was set correctly on the enemy character prop root, even though there is this error, so I am not very sure. It would be great if you can help me look into this, thank you. 

1 Answer

0 votes
answered by (7.3k points)

Hey,

Looks like a bug, thanks! I'll work on a fix, but in the meanwhile, does it help if you remove the prop (propRoot.currentProp = null) before you call to remove the arm?

Also, I have recently found a much more efficient way to remove/reattach body parts, as RemoveMuscleRecursive and Rebuild need to calculate a lot of stuff. It's not an official feature yet, but there are instructions in this post. I'll add in proper API for that in the next version.

Best,

Pärtel

commented by (150 points)

Hi 

I tried to use propRoot.DropImmediate() instead of propRoot.currentProp = null before I call to remove the arm from your suggestion and it does not work as the same error still appears. 

I think I will try to look into the more efficient way to remove/reattach body parts without using removeMuscleRecursive and Rebuild to understand the system better and maybe to use it instead

commented by (150 points)
Hi again

I tried using the other more efficient way to remove/reattached the body however I realised my enemy character is set in kinematic mode as I want to use the finalIK for the hit reaction and I dun want them to overlap each other as well as some other reasons that my game needs it to be.

Seems like the things that I am using does not work so well in Kinematic mode, like breaking of the head and arms of the enemy character I have to go into your code to set the broken parts' rigidbody's isKinematic to false in order for them to fall and roll over nicely. Just fyi :D
commented by (7.3k points)
Hey,

I'm nearly done with the new msucle disconnection/reconnection API. Please write to me next monday to support@root-motion.com with your invoice number and I'll send you the latest.

Best,

Pärtel

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.

...