PuppetMaster - Advanced Character Physics Tool [RELEASED]

Hi Partel,

There is an offset in the upper body whenever the puppet gets unpinned:

I have no idea what’s causing it, there is no IK active on the body. Any idea what could be causing it? The mapping weight for all muscles is at its default of 1.

EDIT: Whenever I enable ‘Map Position’ for the misaligned muscles it fixes the issue - is this intended/desired behaviour?

Hi Pärtel,
How can i determine my character is in the air and fall down from sky?
i have a ragdoll character and and i want to release him from roof top a building.
how can i tell the character if he is in the air for more than 2 seconds , then the behavior fall should be playing ( i also have an falling animation and i want the animation to be played while falling).
thanks.

Partel,

I’m still dealing with the issue of when props are dropped to the terrain, they do not come to rest. We had a private conversation back in July on the subject and you determined that it was a floating point precision problem with physics on terrains where the further props are dropped from world origin the more problematic they are. I’ve tried dozens of solutions and nothing works. Adjusting Rigidbody.sleepThreshold, mass and friction, changing the size of the prop colliders over time etc. etc. I am unable to find any consistent way to get props to come to rest when dropped on terrain.

I was wondering if you could provide a patch or an update that has the option to Destroy the configurable joint when dropped and Add it when picked up for props. You do something similar when using Grab in the Melee Grab demo so I’m assuming this would work for props.

Thanks
Allan

Hi all, sorry for the delay, I’m back in office now…

Hey,
Does it still happen when you comment out line 678 in Muscle.cs?

Hey,
It can happen when you have animation on one of the spine bones that is not part of the ragdoll. If you see this, enabling “Map Position” for the spine muscles is the correct solution.

Hey,
You could just raycast down from the root of the character and if that distance is beyond of which he can recover from (like 3 meters or whatever), call behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned);
Just make sure that raycast does not hit the character controller or the ragdoll layers.

Hey,
Do the props come to rest when there is no ConfigurableJoints attached to them?

Cheers,
Pärtel

1 Like

thanks man.

Partel,

Good question. Actually no they keep bouncing around even when I manually remove the ConfigurableJoint. I’ll try multiplying mass by 10 when dropped and go back to default when picked up. That seems to help.

Allan

Hey,
Could also try adding a script when they are dropped, that checks for rigidbody.velocity.sqrMagnitude and if that’s below a threshold for a sec or so, call rigidbody.Sleep();

In my game I might have an enemy that is lets say 10 degrees to the left. I want to rotate the character’s chest 10 degrees to the left, so his sword hits the enemy. This is a relative adjustment to the IK, where all the usual values are the same, but rotated left around the chest by 10 degrees.

I tried to do this with AimIK, but the problem is that AimIK is absolute (look at this fixed point throughout the animation) rather than relative (look left throughout the animation). I guess I could make some child node on the character, orient it 10 degrees to the left, and have AimIK look at that.

But is there an easier way?

I did not see the error a while now but i comment line 678 out and tell you when something pops up

Hey,
Please take a look at the “Aim Swing” demo:

public AimIK ik;
        [Tooltip("The direction of the animated weapon swing in character space. Tweak this value to adjust the aiming.")] public Vector3 animatedSwingDirection = Vector3.forward;

        void LateUpdate () {
            ik.solver.axis = ik.solver.transform.InverseTransformVector(ik.transform.rotation * animatedSwingDirection);
        }

Hello Partel,

I saw the error today again

Comment out the line 678 in Muscle.cs does not help

Hey,
Sorry to bounce you, but could you add this to line 679, it should log a bunch of variables right before that error pops up, please give me a screenshot of them the next time you see the bug:

if (float.IsNaN(force.x) || float.IsNaN(force.y) || float.IsNaN(force.z)) {
                Debug.Log("[Muscle] positionOffset.x: " + positionOffset.x);
                Debug.Log("[Muscle] positionOffset.y: " + positionOffset.y);
                Debug.Log("[Muscle] positionOffset.z: " + positionOffset.z);
                Debug.Log("[Muscle] fixedDeltaTime: " + Time.fixedDeltaTime);
                Debug.Log("[Muscle] w: " + w);
                Debug.Log("[Muscle] rigidbody.velocity: " + rigidbody.velocity);
                Debug.Log("[Muscle] pinDistanceFalloff: " + pinDistanceFalloff);
                Debug.Log("[Muscle] positionOffsetSqrMag: " + positionOffset.sqrMagnitude);
            }

Thanks!
Pärtel

I added a rewind button: hit the button and poof my animation goes back to frame 1.

When I do that, PuppetMaster goes completely bonkers; my character does this bizarre dance with all the limbs and head orbiting the pelvis, and the solver never reaches quiescence. Looks quite painful. I presume it’s that all the velocities are messed up because I teleported everything.

Is there an ideal way to reset PM’s internal state, short of deleting the rig and re-creating it?

EDIT: if I explicitly set the muscle transforms to match their targets in the frame that I teleport, seems to work great:

foreach(var muscle in m_puppet.muscles) {
  muscle.joint.transform.position = muscle.target.position;
  muscle.joint.transform.rotation = muscle.target.rotation;
}

Hi, I am looking to use Puppetmaster in my project but is a bit concerned about performance. I will use it for Enemy AI and on a normal level there can be up to 30 enemies. Now you never see that many at the same time, the maximum is around 10 that are visible at the same time. In normal mode the puppetmaster is set to disable(they get activated they die etc.) Looking at the profiler the PuppetMaster.LateUpdate takes around 5-8ms for all of the enemies(on a low target platform)

What I wonder if there is any good optimization that can be done to puppets outside of view? I already did all the suggestion on the optimization page and that helped but I would like to further get the time down.

Hey,
Have you tried deactivating the PuppetMaster gameobject for the ones that you normally disable?

Hello! First can I say, I love this asset, it’s excellent. Secondly, I have a question:

Using the supplied 'User Control AI script, how would I go about triggering the AI to ‘Jump’?

Thank you!

Hey, thanks!

As in UserControlThirdPerson.cs:

state.jump = canJump && Input.GetButton("Jump");

But instead of Input.GetButton, use a bool function that returns true whenever your AI deems appropriate to jump.

Thank you, i’ll give this a go!

Edit: I can’t believe how simple that was, thanks for the quick response!

Hello @Partel Lang

I have problem with puppet master that :
we can’t use LookAt method for Puppet victom to keeps looking at the target.
if i use LookAt on puppet victom parent object then disturb the victom posture.
so please help me how can i achive victom to always keeps looking at the target.

I am having trouble creating proper ragdolls from Blender models. I have tried exporting the fbx in many ways (including using this fix ).

No matter what I try, I always see that the green axis is sideways:

Compared to the models in your video which all show that the green axis is Up/Down:

The issue it seems to be causing is strange feet placement during a get up animation:

How do I rotate that green axis? Or do you believe it is even part of the problem?
Also Is there anywhere I can find information that explains what ragdoll creator expects for proper “input” bone rotations?

Thanks.