Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

PuppetMaster - Advanced Character Physics Tool [RELEASED]

Discussion in 'Assets and Asset Store' started by Partel-Lang, Oct 1, 2015.

  1. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,663
    Hey,
    What do you have assigned for "Target Root" in PuppetMaster? It should be the character controller gameobject that has the nav mesh agent and the animator and all that. The root transform of the entire rig should not have those components, consider that as just a folder for the dual rig. The reason why you should not move that is because the PuppetMaster is parented to it and the ragdoll needs to be driven by physical forces alone and not inherit any motion from the character controller.

    Hey,
    The blue ball should be parented to the animated character hierarchy, not the ragdoll, as that's what you'll see when PuppetMaster is done writing. It could be coming from AimIK, it is a heuristic solver, so it's never 100% accurate and minor inaccuracies could look like that when seen through the scope I guess.

    Hey,
    I wonder why the legs behave like that when you switch, it's probably related to the explosion. Any chance you could send me a link to a repro project to support@root-motion.com?

    Yeah, sorry, It's not a pricing model I specifically designed, it's just Unity promoting their subscription. PuppetMaster is on a sale quite frequently though, I join a sale every chance I get.

    Cheers,
    Pärtel
     
  2. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    149
    I'll check that when I'm home, but I think it's the top-most parent which then contain the Behaviour, One of my own component (a UI Damage Canvas to show the damage numbers), the ragdoll (Puppetmaster) and then the root which has all the Animator and Motion controller and all. This Root has the regular bones

    I used the PuppetMaster regular wizard to create that.

    -CharacterRoot (nothing on it)
    --DamageCanvas
    --Behaviour
    ---Puppet
    ---Fall
    --PuppetMaster
    ---All The ragdolls
    --Root (containing animator, Ootii Motion controller and all)
    ---Children bones

    Should it be different? Because the one that is the issue that stay in-place is just the Behaviour even my DamageCanvas UI moves properly with the character
     
  3. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    149
    Ok so, after Puppet Master wizard my hierarchy looks like that:

    upload_2018-7-9_20-19-44.png

    The target root references the proper object:

    upload_2018-7-9_20-20-37.png

    I moved the "Behaviours" under "Character_Medusa_01" and it moves properly with the character now (even though the Gizmo stays in-place, but I guess that's not a big deal, right?)

    Is it ok to do like so? Or should the Behaviour parent be at the top-most root parent for some reasons?

    thanks for your support
     
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,663
    Hey,
    I wonder what is reading the position of the "Behaviours". The behaviours themselves never do that, they always use puppetMaster.targetRoot for character position. PuppetMaster itself also doesn't care where that gameobject is.
    The hierarchical position matters only as much as PuppetMaster needs to be able to find the behaviours and it does it like so:
    Code (CSharp):
    1.  
    2.             behaviours = transform.GetComponentsInChildren<BehaviourBase>();
    3.             if (behaviours.Length == 0 && transform.parent != null) behaviours = transform.parent.GetComponentsInChildren<BehaviourBase>();
     
  5. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    102
    Thanks, i will try to create a new instance of the weapon and filter out the bugs with some mathf and maximal traveling per frame to have the weapon separate following the real prop when the player aim in first person.
     
  6. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    102
    Will Puppet Master and / or Final IK use the new Unity Job System for high performed code?
     
  7. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    67
  8. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    67
    Partel, in this video



    I am using Final IK to get the tripod puts its feets over groung, but I cannot get it works properly

    I have managed well this small aliens and soldiers (as you can observe in video), but not with Tripods. What can I be doing bad? I am using a mesh variation of 3DMAESEN Tripod
     
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,663
    Hey,
    Already working on creating AnimationJob versions of my IK solvers. They will have to be built from scratch though so it will take time. About PuppetMaster, there's not much that can be done with Jobs at the moment, but Unity is working on some solutions that might make it possible to implement it.

    Hey, thanks for sharing the new video, looking cool! :)
    Which solver are you using for those tripod legs? Have you verified that the IK targets are in the right places, where they are supposed to be? Have you tried to increase max iterations?

    Best,
    Pärtel
     
    Useless-Media and hopeful like this.
  10. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    67
    Thanks for your quick response Partel. I am using Grounder IK and yes, the ik targets is supposed to be in right place. Any suggestion?:





     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,663
    Hey,
    Does it work if you set "Quality" to "Fastest" in GrounderIK?
    If you could send me that fbx and a walking animation to support@root-motion.com, I'd take a look.

    Best,
    Pärtel
     
  12. Soulghai

    Soulghai

    Joined:
    Mar 24, 2016
    Posts:
    3
    Hello Partel!
    I saw your Bomb demo in Final-IK. But it's not exactly what I want.

    I'm trying to do this
    _puppetMaster.state = PuppetMaster.State.Dead;
    r.velocity = (direction.normalized + Vector3.up * upForce) * explosionForce * forceMlp;

    Puppet dropped but force didn't apply. I'm newbie )
    Can you help me?
     
  13. Useless-Media

    Useless-Media

    Joined:
    Apr 19, 2015
    Posts:
    102
    Velocity on the muscles gets applied when you kill your puppet.
    Because of this reason i made this Function which i put in the PuppetMasterStates.cs

    I have need this to move the muscles rigidbody directly after the kill, so i created KillImmediately to kill the puppet this way.

    Code (csharp):
    1.  
    2.         /// <summary>
    3.         /// Kill the puppet Immediately
    4.         /// </summary>
    5.         public void KillImmediately()
    6.         {
    7.             //state = State.Dead;
    8.             activeState = State.Dead;
    9.  
    10.             mode = Mode.Active;
    11.  
    12.             if ( stateSettings.enableAngularLimitsOnKill )
    13.             {
    14.                 if ( !angularLimits )
    15.                 {
    16.                     angularLimits = true;
    17.                     angularLimitsEnabledOnKill = true;
    18.                 }
    19.             }
    20.  
    21.             if ( stateSettings.enableInternalCollisionsOnKill )
    22.             {
    23.                 if ( !internalCollisions )
    24.                 {
    25.                     internalCollisions = true;
    26.                     internalCollisionsEnabledOnKill = true;
    27.                 }
    28.             }
    29.  
    30.             // Set pin weight to 0 to play with joint target rotations only
    31.             foreach ( Muscle m in muscles )
    32.             {
    33.                 m.state.pinWeightMlp = 0f;
    34.                 m.state.muscleDamperAdd = stateSettings.deadMuscleDamper;
    35.  
    36.                 m.rigidbody.velocity = m.mappedVelocity;
    37.                 m.rigidbody.angularVelocity = m.mappedAngularVelocity;
    38.             }
    39.  
    40.             foreach ( Muscle m in muscles ) m.state.muscleWeightMlp = stateSettings.deadMuscleWeight;
    41.             // Disable the Animator
    42.             SetAnimationEnabled( false );
    43.             foreach ( BehaviourBase behaviour in behaviours ) behaviour.KillStart();
    44.             foreach ( BehaviourBase behaviour in behaviours ) behaviour.KillEnd();
    45.             if ( OnDeath != null ) OnDeath();
    46.             lastState = State.Dead;
    47.             state = State.Dead;
    48.         }
    49.  
     
  14. Soulghai

    Soulghai

    Joined:
    Mar 24, 2016
    Posts:
    3
    Thank you, Useless-Media.
    Character dying immediately. But then he lies absolutely calmly =)
    I can't push the puppet up
     
  15. richie-greene

    richie-greene

    Joined:
    Jul 3, 2015
    Posts:
    36
    Hey
    Just start using PuppetMaster and wrapping my head around it, so apologies if this was asked before earlier in the forum.
    I am integrating it with Easy Character Controller... which is a rigid body based third person controller. So not using root motion in anims... instead using physics for char control.
    I have just setup my ragdoll with puppetmaster running a bsic idle anim... when I mmove around its all working fine... and my ragdoll tracks the target anim.
    The problem I noticed is that when I jump.. and land.. the character control & associated capsule collider stops on collision with the ground, but my ragdoll mesh & feet colliders go through the ground over a number of frames before raising back up to match the target hip position.
    I have animate physics enabled, have tried different interpolate options etc.
    Anything come to mind or have you seen similar behaviour when using this style of controller.
    If it was a case of one being calculated in wrong update timestep, I would expect it to snap to correct position on nect frame.. rather than blend over a number of frames?
    Thanks
    R
     
  16. richie-greene

    richie-greene

    Joined:
    Jul 3, 2015
    Posts:
    36
    Update:
    If I set fixed timestep to something like 0.1, its alot worse...the target skeleton visualisation is in correct position relative to character controller capsule collider, but ragdoll going through floor, away from target when character lands, then moves to correct position of skeleton over a few frames
    I set the puppet to kinematic it works.
    I noticed when puppet set to alive, if I slow time... visualised target skeleton lags behind ragdoll colliders as it renders each frame. This does not happen when in kinematic.

    I’m thinking its an update timing issue between char controller and ragdoll muscles? I think the char controller solves in a late fixed update? Would this cause such a problem?

    Thanks
    R
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,663
    Hey,
    You'll have to set the velocity of the muscles, not the character rigidbody:
    Code (CSharp):
    1. foreach (Muscle m in puppetMaster.muscles)
    2.             {
    3.                 m.rigidbody.AddExplosionForce(force, position, radius);
    4. }
    Hey,
    Maybe the PuppetMaster is parented to that character controller? The PM dual rig hierarchy should look like this:
    1) Root (nothing on it, just a folder for the rig)
    2)Character Controller (the character controller and the animated character model)
    2)PuppetMaster

    If PuppetMaster is a child of the Character Controller, it will inherit velocities from it, which it should not do and that might cause the problems you are seeing.
     
  18. richie-greene

    richie-greene

    Joined:
    Jul 3, 2015
    Posts:
    36
    Hey
    Yeah I checked the hierarchy and its setup correctly.
    Not sure if you read my update... it all works fine when set to kinematic... its like the ragdoll rigidbodies are lagging behind the character target positions when active.. Are you using rb.setposition when adtive? I know that behaves different when kinematic is on/off... one interpolates, the other teleports right? Just thinking out load!
    You got any demos of this working with a rigibbody character controller... ?

    Out of interest, when I set this up as per docs, didnt tweak any muscles.. my characters head lags when I turn my character controller... and settles into animation like its on a rotation spring... reducing the mass to 1, which is too low, reduces the effect... but its still there. I thought with full pinning and weights and mapping it would track the animation... could it be related?

    Thanks
    R