Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. 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,713
    Hey,
    It's a known limitation with current PuppetMaster, you should not parent puppets to the same gameobject.
    It's in MuscleCollisionBroadcaster.cs, lines 93, 104 and 115. It checks if collision collider transform root is the same as muscle transform root to skip processing internal collisions. This limitation is there because it is the fastest way to check that and it needs to be as fast as possible because there could be a lot of collision messages each frame. Wouldn't want to do a GetComponent call there.

    Best,
    Pärtel
     
  2. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    564
    Oh, I see, so any and all characters should have no parent at all? That very well might account not only for the issue I was having with it not colliding properly, but some of the performance issues than I would guess, too?

    Just to be sure I am understanding you correctly, I have the actual PuppetMaster character still setup the way it is supposed to be. If you see below, I have a root object, which I am counting as "my charcter", so under that root object is my actual character that has the controller, I have the puppetmaster, and the behaviors. That has not changed. The only thing I was attempting to do was place my characters root under another gameobject, which in the pic would be the "Pedestrians" gameobject of my waypoint system.




    In this second image, you will see how I took the "WaypointSystem-Ped" and put that under the "Systems" game object along with the "WaypointSystem-Veh", that was when I began to have lots of issues.



    Am I understanding you correctly that the actual character root object should be directly in the root of the hierarchy and not under any sort of parent except for itself?
     
  3. flow-

    flow-

    Joined:
    Apr 19, 2015
    Posts:
    105

    It should not on the same root because of the MuscleCollisionBroadcaster of the Muscles.
    Im sure this have a deeper reason but when you look in the MuscleCollisionBroadcaster.cs in the CollisionEnter Function at line 105 then you have see a blocking of collision behaviour.
    Code (csharp):
    1. if (collision.collider.transform.root == transform.root) return;
     
    Partel-Lang likes this.
  4. Chris45215

    Chris45215

    Joined:
    Jan 30, 2016
    Posts:
    6
    Partel, an additional person has my project and we'll both be using the characters made with PuppetMaster, though I may be the main person setting up and configuring the puppets. I can't find the license terms for PuppetMaster and the asset store isn't quite clear on the topic. Should I purchase an additional license for my collaborator on this project, or are we fine using just the single license?

    The tool is so good and I don't want to shortchange you.

    Thanks,
     
  5. ChaosriftGames

    ChaosriftGames

    Joined:
    Aug 25, 2017
    Posts:
    8
    Problem i'm having.

    Using Invector Shooter
    I have layers, Ground, Projectile, Ragdoll, Enemy, player.
    Puppet Master character uses Enemy for the character. Ragdoll for the puppetmaster stuff. Ground for ground.

    I blow up a barrel it properly applies force. Ragdoll goes flying. But it then snaps back to the original standing point.
     
    Last edited: Sep 17, 2018
  6. cspid

    cspid

    Joined:
    Apr 25, 2014
    Posts:
    13
    Hi Partel - having a bit of an issue working with Puppetmaster and the Ootii controller. I've run the package and set up the puppet with the ootii puppet script, but I get strange behaviour when the character gets up from a fall - he springs back to a standing position instead of doing the recovery animation and then is unable to move for a few seconds. Do I need to fix something in the animator? Thanks.
     
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,713
    Hey, sorry for the delay, was on a brief vacation.

    There isa brand new EULA since Sept 14 and they have clarified this particular issue (see 2.4).

    Hey,
    Haven't tried Invector Shooter, but I have just updated Ivector's Third Person Controller integration package.
    If it snaps back to where it fell, it's probably because Invector's controller forces it there. The controller needs to be disabled while the puppet is unpinned.

    Hey,

    You'll have to copy the "BehaviourPuppet" and "BehaviourFall" Sub-State Machines from the "Humanoid Third Person Puppet" animator controller to the controller used by your character and make a state machine transition from "BehaviourPuppet" to the idle or locomotion state of your controller.

    Also just recently updated the Ootii integration package.

    Best,
    Pärtel
     
  8. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    271
    Hey Partel,

    is it possible to simulate the ragdoll behaviour in a single frame? What I'm trying is to show spawned dead npcs on ground (without any death animation or ragdoll) for players who join my game server.
     
  9. fornetjob

    fornetjob

    Joined:
    Sep 11, 2014
    Posts:
    13
    How I can disable a puppet's leg if it is shot by a player, for example?
     
  10. fornetjob

    fornetjob

    Joined:
    Sep 11, 2014
    Posts:
    13
    Im bougth FinalIK, but hit reaction not working. How to set hit reaction (shoot) in PuppetMuster with Final IK(or without), without fall?

    Code (CSharp):
    1. NullReferenceException
    2. UnityEngine.Transform.get_rotation ()
    3. RootMotion.FinalIK.HitReaction+HitPointBone+BoneLink.Apply (RootMotion.FinalIK.IKSolverFullBodyBiped solver, Quaternion offset, Single crossFader) (at Assets/Plugins/RootMotion/FinalIK/Tools/HitReaction.cs:167)
    4. RootMotion.FinalIK.HitReaction+HitPointBone.OnApply (RootMotion.FinalIK.IKSolverFullBodyBiped solver, Single weight) (at Assets/Plugins/RootMotion/FinalIK/Tools/HitReaction.cs:201)
    5. RootMotion.FinalIK.HitReaction+HitPoint.Apply (RootMotion.FinalIK.IKSolverFullBodyBiped solver, Single weight) (at Assets/Plugins/RootMotion/FinalIK/Tools/HitReaction.cs:73)
    6. RootMotion.FinalIK.HitReaction.OnModifyOffset () (at Assets/Plugins/RootMotion/FinalIK/Tools/HitReaction.cs:230)
    7. RootMotion.FinalIK.OffsetModifier.ModifyOffset () (at Assets/Plugins/RootMotion/FinalIK/Tools/OffsetModifier.cs:95)
    8. RootMotion.FinalIK.IKSolver.Update () (at Assets/Plugins/RootMotion/FinalIK/IK Solvers/IKSolver.cs:56)
    9. RootMotion.FinalIK.IK.UpdateSolver () (at Assets/Plugins/RootMotion/FinalIK/IK Components/IK.cs:27)
    10. RootMotion.SolverManager.LateUpdate () (at Assets/Plugins/RootMotion/Shared Scripts/SolverManager.cs:113)
    11.  
     
    Last edited: Sep 27, 2018
  11. ChaosriftGames

    ChaosriftGames

    Joined:
    Aug 25, 2017
    Posts:
    8
    So here's my test scene. I swapped to Emerald AI for this. The big guy to the far left fell down and rolled a bit, which was awesome. But he left his Box Collider and Navmesh Agent far behind as seen in the picture.

    This happens regardless of if I wrote my own character script or using a precanned AI script.

    Also, once they stand back up, they remain separated from their collider and navmesh. I'm assuming in code you could just have it cache the local coordinates and snap them back together after a fall is in the recovery phase.



     
  12. Termotank

    Termotank

    Joined:
    Sep 1, 2015
    Posts:
    6
    Hi Partel, awesome work! Just a small question.

    Is it possible to connect Leap Motion with your plugin?

    If yes, TAKE MY MONEY PLEASE!
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,713
    Hey guys, sorry for the delay, been traveling to the States for Oculus Connect 5.

    Hey,
    Not really. You could sync localRotations of the ragdoll bones on initiation though.

    Hey,
    Set muscle.props.pinWeight to 0 and reduce muscle.props.muscleWeight for the leg muscles.
    You can use puppetMaster.SetMuscleWeightsRecursive for that.
    Would also be good to switch to some kind of hopping on one leg animation like when you shoot a leg off the skeleton in the "Removing Muscles" demo.

    Hey,
    HitReaction will produce this error if there is a missing bone reference. Expand the "Bone Hit Points" in the bottom of HitReaction, then also expand "Bone Links" and you should see a missing bone under "Element 0".

    Hey,
    The NavMeshAgent or any other AI script needs to be on the Target Root gameobject (the one that has the Animator), not the root of the entire rig (that is just a folder for the rig and should not be moved). That is usually the cause of problems like this. I have also just made a demo for NavMeshAgent for the next version of PM.

    Hey,
    I don't have an integration tool for PM and LeapMotion, sorry. Technically it should be possible though, PM can be used on any ragdoll hierarchy.

    Best,
    Pärtel
     
  14. ChaosriftGames

    ChaosriftGames

    Joined:
    Aug 25, 2017
    Posts:
    8
    Pärtel

    Welcome to the States!

    Tried it out. Even the punching dummies from your sample scenes do this. The Root where the original skeleton and model were shifts out of place while the top level parent and puppetmaster portions stay in place. So puppetmaster will be at 0,0,0 local to the parent and the Root with animator and scripts will be like 0.9,0,2 Local coordinates.

    I'm using a simple explosion that applies force which knocks these guys around. Also a character just tripping will also shift from the 0,0,0. I love all these effects and hope I can get everything working for my game.
     
  15. Chris45215

    Chris45215

    Joined:
    Jan 30, 2016
    Posts:
    6
    Partel, thanks and I just got the second license.

    I'm trying to implement the system on some AI enemies, a lot like the Melee demo scene that is included with puppetmaster, but I've having some difficulty because the enemies don't turn unless they are also moving forward. If there's a simpler way that I should implement this, or some easy-to-integrate melee enemy movement controller in the asset store, please let me know! Otherwise, if using that Melee demo scene as the example, you should be able to recreate the issue by setting the parameter Bot Puppet -> Character Controller -> User Control AI -> Stopping Distance to a higher value like 3. Then, run the scene, and after the bot stops, move the user-controlled puppet forward and slightly past Bot Puppet. As long as you stay within the stopping distance, Bot Puppet won't turn to face the target. It seems that he only turns when he's also walking forward, even though the animation blend tree includes animations to turn without changing position.

    I've been trying to isolate the cause, but the scripts are far smarter than I am, so I could use a hand. I've gone through some of the CharacterAnimationThirdPerson script, and the function GetAngleFromForward() returns 0 during the "should turn but doesn't" situation. So, line 64 runs with the values animator.SetFloat("Turn", 0). I'm not sure if that causes the problem. But I can't even grasp how GetAngleFromForward() works because it seems like it's just calling Vector3 local = transform.InverseTransformDirection(transform.forward) but the transform.forward is from the prior frame, so is that just calculating the change in transform.forward from one frame to the next? But deltaAngle is subtracted from the result of that, and I thought deltaAngle was the change between frames. I can't even start to understand how all this works, or how OnAnimatorMove() comes into it, but it all seems to relate.

    I'm guessing this all ensures that the controller moves and rotates in sync with the animation. But could that be done more simply by applying the root motion of the animations? Or is the entire system made so that the animation does the turning (to allow different animations to be put in very easily) and then the scripts figure out when to stop turning?
     
  16. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,713
    Hey,
    Sorry I think I don't fully understand. Could you tell me the exact steps to reproduce it in one of the demo scenes?

    Hey,
    First go to UserControlAI.cs and add this line:
    Code (CSharp):
    1. state.lookPos = moveTarget.position;
    Then enable "Look In Camera Direction" in CharacterThirdPerson component.
    And finally, set "Turn Sensitivity" to 2 and "Turn Speed" to 2 in CharacterAnimationThirdPerson component that is on the gameobject that has the Animator.

    Best,
    Pärtel
     
  17. Pan4ezzz

    Pan4ezzz

    Joined:
    Jul 9, 2017
    Posts:
    12
    Hey Pärtel,
    asset is awesome, but listen unity physics is not predictably, especially for network. So can you help with behaviour for getting up only, like BehaviourFall for only one decision - getting up and ending
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,713
    Hey,
    If you are trying to get PM networked, there's an UNet example included under "Plugins/RootMotion/PuppetMaster/_Integration", that might help.

    But about just getting up, the way BehaviourPuppet does it, is move the animated character to the position of the pelvis rigidbody, check if the ragdoll is in a prone or supine pose by checking the dot product of pelvis forward and Vector3.up (line 12 in BehaviourPuppetHelpers.cs and the 2 blocks starting from line 135 in BehaviourPuppetStateSwitching.cs) and play a prone/supine get up animation according to that. Then just gradually weigh in the pin weight.

    Best,
    Pärtel
     
  19. devis

    devis

    Joined:
    Aug 23, 2014
    Posts:
    28
    Hi! I noticed that the Intergration with Invector's Controller doesn't really work anymore. Im using the Shooter version.
    Not at all actually. When you create the Puppet using the script provided, it does create the puppet
    but the Puppet is not following the character. It just stays in place and seems to be stuck on torso level.
    Another issue is that the character starts to sink to ground via also stretching the legs?
    And when you do get hit, the character goes insane and stretches all over the place.

    I also get error to console about having the Controller and Puppet at same place, but they ARE at same place when the scene starts. Any ideas? I fixed the namespace errors that were there, it worked the first time perfectly but now it doesn't work at all.
     
  20. Utopien

    Utopien

    Joined:
    Feb 15, 2016
    Posts:
    12
    Hello I'm wondering if puppet master can be efficiency sync to a network like photon it seems to have many values the sync with a game up to 20 or 30 character at the same time is a reasonable?
     
  21. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    71
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,713
    Hey,

    The Invector package in current PuppetMaster is out of date, as they have updated their stuff. Here's the latest I have from 1-2 months ago.

    Hey,
    It's like with any ragdoll physics networking. There is a basic UNet demo included in the package under Plugins/RootMotion/PuppetMaster/_Integration. So in that demo, the ragdolls are not synced all the time. Ony when BehaviourPuppet goes into Unpinned state (puppet loses balance), then the ragdoll syncing will start and lasts until it gets up again. On the remote end, BehaviourPuppet will never lose balance on it's own, just when it gets an RPC to do so from the owner. So the remote client is locally simulated for the most part.

    That said, you should not expect to have 30 puppets active simultaneously anyway, due to CPU performance.

    Best,
    Pärtel
     
  23. mrstruijk

    mrstruijk

    Joined:
    Jan 24, 2018
    Posts:
    3
    Hi Pärtel!

    Maybe I missed this in the tutorials or documentation, but how can I add (working) colliders to the existing ragdoll? I need to use the hands pretty extensively, and while working with the Manus, the physics doesn't seem to update.

    I copied the joints from the model hand, pasted them under the hand in the PuppetMaster section, and added the colliders, configurable joint and rigidbody.

    I tried changing the script execution order, but that didn't seem to do the trick.
    ezgif.com-optimize (1).gif

    Best,
    Maarten