0 votes
asked in General Help by
I would like to have a character that reacts and falls when getting hit, much like the character in the Puppet demo scene, but constrain him to a 2d plane (i.e. making a 2d game, so would like to constrain characters to a specific z).  Obviously, limbs, body/parts, etc. should be able to go off of that specific, but only while root is constrained to that z.  I've tried just constraining the character's capsule rigidbody in that demo scene, but when he falls, he is allowed to move off of that z value.

Any ideas/thoughts how this can be done with PuppetMaster?

Thank you in advance!
commented by
After playing around a bit, I've gotten _reasonably_ good results by constraining the z position of the character root (with the capsule rigid body on it) and the pelvis puppet part.  Would still like to know if there's a better/preferred way of doing this tho.

1 Answer

0 votes
answered by (12.1k points)

You could add another ConfigurebleJoint to the pelvis and set it's "Z Motion" to "Locked". No need to set a Connected Body, it will be locked to the world like that.
commented by
I gave that a try, but to no avail.  I tried just ticking the checkbox on the existing ConfigurableJoint and also tried adding another one as you suggested, but neither would keep the z motion to 0 without also having the rigid body's z motion constraint checked.  

Beyond that, I was getting an issue where the character controller was moving off of the specified z as well, which caused the visible character to flicker as the physics tried to pin to a point it could never get to.  I finally realized that the CharacterBase class sets the RigidBody's constraints to no rotation, which was removing the z motion constraint.  So I created a new derived class and re-set it in the Start() function.  At this point, the character appears to be acting almost exactly as I'd like him to in a 2D fashion so I think this will be the solution unless I run up against any other new problems.  The last remaining issue is one that seems to show up for all PuppetMaster powered characters, which is that sometimes when getting up from prone or supine, the character slides a bit as it transitions to the get up animation.

One other issue I ran into was that the GetSlopeDamper() function was preventing my character from moving, initially.  He would turn in the direction I pressed but he wouldn't start walking (although I could get him to walk if I jumped and moved and then kept moving when I landed).  This turned out to be because the forwardMlp was being set to 0 due to what seems like an incorrect implementation in that function (it could be something I'm doing wrong because it seems to work for other characters, tho).  Unfortunately, that functionality is private to the CharacterBase class and so I could not override it - would it be possible to make the fields that function uses protected and the function itself virtual?

Thank you for your time.

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.