Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    2,548
    Here's the API with some comments:

    Code (CSharp):
    1. // params: HumanBodyBone, muscleWeight, pinWeight, mappingWeight, muscleDamper. The last 3 params are optional
    2.         puppetMaster.SetMuscleWeights(HumanBodyBones.Head, 1f, 1f, 1f, 1f);
    3.  
    4.         // Using a direct reference to the bone (in the target, not the ragdoll bone)
    5.         puppetMaster.SetMuscleWeights(target, 1f, 1f, 1f, 1f);
    6.  
    7.         // Set weights by group. If using Muscle.Group.Arm, both arms will be affected.
    8.         puppetMaster.SetMuscleWeights(Muscle.Group.Head, 1f, 1f, 1f, 1f);
    9.  
    10.         // Using muscle index. In this case, the first muscle in the PuppetMaster.muscles array
    11.         puppetMaster.SetMuscleWeights(0, 1f, 1f, 1f, 1f);
    12.  
    13.         // Set weights for the left upper arm recursively so the forearm and hand will also be set.
    14.         puppetMaster.SetMuscleWeightsRecursive(HumanBodyBones.LeftUpperArm, 1f, 1f, 1f, 1f);
    15.  
    16.         // Using muscle index. This will set weights for all the muscles (might as well use PuppetMaster.muscleWeight/pinWeight...)
    17.         puppetMaster.SetMuscleWeightsRecursive(0, 1f, 1f, 1f, 1f);
    18.  
    19.         // Use this if you have a direct reference to the target bone
    20.         puppetMaster.SetMuscleWeightsRecursive(target, 1f, 1f, 1f, 1f);
     
    hippocoder likes this.
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey, there seems to be a bug with ParticleSystem in Unity 5.3.1, it creates some weird error messages "Invalid AABB result" in the "Melee" and "Puppet Raycast Hit" demos. Just deactivate the "Blood 1" GameObject that has the ParticleSystem for now to get rid of the messages. Trying to figure something out...
     
    Mikael-H and hopeful like this.
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey, just finished with making an integration tutorial for Opsive's Third Person Controller:


    Forgot to mention in the video that for the current version of Opsive (1.1.1) you need to add 2 lines of code, so the full script would be:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Opsive.ThirdPersonController;
    4. using RootMotion.Dynamics;
    5.  
    6. public class OpsivePuppet : MonoBehaviour {
    7.  
    8.     public BehaviourPuppet puppet;
    9.     public ControllerHandler controllerHandler;
    10.     //public RigidbodyCharacterController character;
    11.  
    12.     // Called by BehaviourPuppet when balance is lost
    13.     public void OnLoseBalance() {
    14.         // Disable the controller so it would not move while the puppet is active
    15.         controllerHandler.enabled = false;
    16.  
    17.         // Set upperbody layer weight to 0 so we could play full body animations freely
    18.         puppet.puppetMaster.targetAnimator.SetLayerWeight(1, 0f);
    19.     }
    20.  
    21.     // Called by BehaviourPuppet when done getting up
    22.     public void OnRegainBalance() {
    23.         // Re-enable the controller
    24.         controllerHandler.enabled = true;
    25.  
    26.         // Weigh upperbody layer back in
    27.         puppet.puppetMaster.targetAnimator.SetLayerWeight(1, 1f);
    28.  
    29.         // Use with Opsive version 1.1.1 and earlier
    30.         //character.StopMovement(false);
    31.     }
    32. }
    33.  
    In the next versions, character.StopMovement(false) will not be required.

    Cheers,
    Pärtel
     
    Dbone and lazygunn like this.
  4. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Haven't tested yet but if everyhings in.order the you a new father christmas
     
    Partel-Lang likes this.
  5. SkutteOleg

    SkutteOleg

    Joined:
    Nov 22, 2014
    Posts:
    5
    Can you please provide an example of setting up "SubBehaviourBipedLegsStagger"?
     
  6. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I just started working on setting up my puppet master character to be able to pick up props. This isn't a bug report so much as a suggestion for making things easier to setup.

    Firstly the prop setup is complicated enough I think it warrants a video tutorial. There are a lot of parts dependent upon one another and your docs don't address a lot of things. With that said, having the melee demo scene is really nice and kudos for including all of the code for the prop setup as part of the package.

    Secondly, I think it's great that you are making the puppet master setup more controller independent. In doing so, I suggest you revisit the melee demo prop setup. Right now the trigger used for a character to pickup a prop in the melee demo is very much dependent on the character having CharacterPuppet.cs that inherits from CharacterThirdPerson.cs. In that OnTrigger code for picking up the prop, once you get a reference to the object based upon it having CharacterPuppet.cs, you then use that reference to check for characterPuppet.puppet.state, characterPuppet.propRoot, characterPuppet.propRoot.currentProp and finally characterPuppet.propRoot.currentProp = prop (attach my prop).

    I admit it took me about an hour to figure out why my character was not picking stuff up even though I thought I had everything set up identically to the melee demo.

    There may be a better way to do those OnTriggerEnter checks without having to require the characterPuppet class with CharacterThirdPerson class inheritance.

    As it is, at least now I realize I need to write my own prop trigger code based upon my particular controller setup.

    Thanks
    Allan
     
  7. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Here is my OnTriggerEnter code for picking up props independent of the controller setup. I made copies of PropPickUpTrigger.cs and LayerMaskExtensions.cs and renamed them with "My" in front of the name. That way my code won't be overridden with future updates. I took both of my new classes out of the Rootmotion.Dynamics namespace. In order for MyPropPickUpTrigger.cs to get a reference to BehaviorPuppet, I need to add the using statement at the top (using RootMotion.Dynamics).....since it is no longer in that namespace.

    Since I only plan to have one main player in my game, I have my player character controller object tagged with "Player" so this works for me.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.Dynamics;
    4.  
    5. public class MyPropPickUpTrigger : MonoBehaviour
    6. {
    7.     public Prop prop;
    8.     public LayerMask characterLayers;
    9.  
    10.     //private CharacterPuppet characterPuppet;
    11.     private GameObject playerObj;
    12.     private PropRoot propRoot;
    13.     private BehaviourPuppet behaviorPuppet;
    14.  
    15.     void Start()
    16.     {
    17.         playerObj = GameObject.FindGameObjectWithTag(("Player"));
    18.         propRoot = playerObj.GetComponentInChildren<PropRoot>();
    19.         behaviorPuppet = playerObj.transform.parent.GetComponentInChildren<BehaviourPuppet>();
    20.     }
    21.  
    22.     void OnTriggerEnter(Collider collider)
    23.     {
    24.         if (prop.isPickedUp) return;
    25.         if (!MyLayerMaskExtensions.Contains(characterLayers, collider.gameObject.layer)) return;
    26.  
    27. //            characterPuppet = collider.GetComponent<CharacterPuppet>();
    28. //            if (characterPuppet == null) return;
    29.  
    30.         if (behaviorPuppet.state != BehaviourPuppet.State.Puppet) return;
    31.  
    32.         if (propRoot == null) return;
    33.         if (propRoot.currentProp != null) return;
    34.  
    35.         propRoot.currentProp = prop;
    36.     }
    37. }
     
  8. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hopeful likes this.
  9. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    I would Love to see an actuall game like this on Steam for example... :D
     
    Last edited: Dec 25, 2015
  10. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi! I have troubles using PuppetMaster. I have Unity 5.3.0 and PuppetMaster 0.2.

    First I import a character that is made by Mixamo. At first I tried to add the Biped Ragdoll Creator to the root but it says:

    Invalid References, one of more Tranforms missing.

    So I place the Biped Ragdoll Creator to the Hips, and it says:

    BipedReferences limb is completely stretched out in the initial pose. IK solver can not calculate the default bend plane for the limb. Please make sure you character's limbs are at least slightly bent in the initial pose. First bone: LeftArm, second bone: LeftForeArm.
    UnityEngine.Debug:LogWarning(Object, Object)
    RootMotion.Warning:Log(String, Transform, Boolean) (at Assets/Plugins/RootMotion/Shared Scripts/Warning.cs:25)
    RootMotion.BipedReferences:AutoDetectReferences(BipedReferences&, Transform, AutoDetectParams) (at Assets/Plugins/RootMotion/Shared Scripts/BipedReferences.cs:181)
    RootMotion.Dynamics.BipedRagdollCreatorInspector:OnEnable() (at Assets/Plugins/Editor/RootMotion/RagdollManager/BipedRagdollCreatorInspector.cs:32)

    Now I can see that the Transforms are in place. But then I click "Create a Ragdoll" and my Unity start to endlessly add compoments saying

    Can't add component 'Rigidbody' to Hips because such a component is already added to the game object!

    Then I have to force the Unity to crash because this loop never endes. It just keeps adding same components (Rigidbody, Box collider and Configurable Joint) over and over again to the hips gameobject.

    Any help?
     
  11. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I'm wondering if you have a quick fix for all of the warnings regarding JointDriveMode no longer being supported.
    I'm using Unity 5.3.0. I'm getting about 14 of them and it's not a deal breaker but it slows down my compile time. I remove annoying warnings whenever I can so compile times are as efficient as possible.

    Assets/Plugins/RootMotion/PuppetMaster/Scripts/Prop.cs(124,49): warning CS0618: `UnityEngine.JointDriveMode' is obsolete: `JointDriveMode is no longer supported'

    Thanks
    Allan
     
  12. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    Hi again Pärtel,

    I am currently testing the UMA integration you sent me and got it working with my own generated avatars. I now have a scene where my girlfriend is running around blasting zombies with a shotgun which is awesome hehe.

    Problem is, after blasting a few zombies (like 20) if I do not remove/recycle them the cpu load gets a bit heavy due to the ragdolls not going to sleep. As the rendering of 20 UMA zombies only takes 2 ms I was thinking they could stay in the scene and show the massive body count.

    Do you have a way to force the ragdoll to sleep or, perhaps even better, lock it in place as kinematic or something? Right now if I set to kinematic or disable the puppetmaster then an animation takes over.

    Cheers,
    Mike
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey guys, sorry for the wait, I've been busy visiting all my relatives, eating blood sausages and sauerkraut :p
    But I'll try to answer your questions now...

    Hey,

    That is WIP stuff, it's not functional yet, still working on it.

    Thanks for the feedback! A prop tutorial is my (already quite long) video tutorial queue, but it's coming :)
    Also I'll try to take make the trigger independent of CharacterPuppet.cs, but it will still need a bit of code (propRoot.currentProp = myProp) to get the job done nevertheless.

    Haha, merry christmas toy you too! that looks ridiculous! :D

    Hey,
    You should keep it on the root, if there are missing references as the message says, you are probably not using the Humanoid rig? Anyway, if you need to use Generic, just fill in the "References" in the component, see if there are some bones that have not been recognised.
    The infinite loop thing when added to the hips is a bug, I'll take a look at it. But the component should definitely be on the root of the character.

    Hey, I have already removed those warnings for the next version, but just comment out the lines that produce the warnings and that's it.

    Hey, I have not thought about it to be honest, but here's how I think it could be done.
    You need to disable animation and PuppetMaster when PM is done mapping the target character to the ragdoll.

    You can do it by adding a script on the animated target character that as a function called "OnPuppetMasterWrite()".

    When it get's called by PuppetMaster, it should be mapped to the ragdoll and ready to go to sleep. So just use it to disable PuppetMaster and the Animator. If you don't need ragdoll physically, you can deactivate the entire PM hierarchy and the mesh will stay there. If you do, you can force the Rigidbodies to sleep with Rigidbody.Sleep();

    Cheers,
    Pärtel
     
    umcherrel and Mikael-H like this.
  14. ez06

    ez06

    Joined:
    Feb 18, 2014
    Posts:
    45
    Hi Partel,

    I would like to animate a football player who's about to shoot the ball. He needs to place his feet in such as way that last step is next to the ball and then, the shooting foot kicks the ball.

    Is this something that Final IK or PuppetMaster would do?

    What about falling after the player gets tackled? Can I do it with Final IK or PuppetMaster is better for that?
     
  15. SkutteOleg

    SkutteOleg

    Joined:
    Nov 22, 2014
    Posts:
    5
    But still, i bet it works better than my attempt to make something like that, am i right?
     
  16. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    Haha, Looks great I've been waiting to see more from you!
     
  17. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    Hi, I was trying to purchase PuppetMaster and then I checked the price and it was $90 then suddenly when I was just about to buy it it said (100 Euro) why is that might it be something I missed to read?
     
  18. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    The author sets a price and then VAT is added automatically based on where in the world you are located.
     
    Partel-Lang likes this.
  19. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    Okay, thanks
     
  20. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I'm still struggling to duplicate the melee prop setup on my own character. I believe I have everything identical except for the actions you have in CharacterMeleeDemo.cs. and I am using one of the free Mixamo Sword Slash animations (Slash(1)).

    I can pick up the prop but my biggest problem is the prop capsule collider and the ragdoll right RightForeArm collider will not stay aligned to the Prop Mesh. It helped a lot when I created a new ragdoll and removed the hand colliders and just used the RightForeArm as my Connect To point as you do with the demo character. But once I start the swing animation, alignment goes all out of whack.

    Here is a pic when I had ragdoll hand colliders. Even before starting a swing, the alignment between ragdoll collider, prop collider and prop mesh is way off: (Click the thumbnail to expand)
    WithHands.png

    Once I got rid of the ragdoll hand colliders, the beginning alignment is much better: (Click the thumbnail to expand)
    NoHands.png

    But once I start the swing, things get way off. Here is a pic halfway through my swing animation.
    HalfwayThroughSwing.png

    Any help would be appreciated.
    I can't figure out how you are able to keep the ragdoll forearm collider and the prop capsule collider so perfectly aligned with the prop mesh on your melee demo character.

    Thanks
    Allan
     
    Last edited: Dec 27, 2015
  21. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    I'm having a problem with the ThirdPersonController, when I start Playmode my character wobbles around and flies away...
     
  22. GrimDjim

    GrimDjim

    Joined:
    Jan 29, 2015
    Posts:
    7
    Please can you do an intergration tutorial with Tim's Ootii Motion Controller 2? I'm a total amateur and been struggling all day with mediocre results. These 2 products working in tandem would be phenominal.
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Are you referring to the Third Person Controller asset or the third person controller set of scripts from the Standard Assets package? If it's the former I had to make some changes to the base Third Person Controller package so it won't fully work until version 1.2. I plan on releasing version 1.2 this week. On the upside the integration works really well - here is a post with a screenshot of PuppetMaster reacting while the jump ability is active.
     
    Partel-Lang likes this.
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,

    Getting the character to the ball is is actually a job for Mecanim. I have never really worked on a football game, but I imagine you'd want to have very good prediction for where the ball will be in a second or so. Then you'll just need to make sure the character is moved to a position where the foot touches the ball in the hitting animation clip within that second. So it's mostly finding the right animation to meet the ball and tweaking the root motion (in OnAnimatorMove) to make sure the character will be there. Final IK can help you widen the range of error (there's a "Soccer Kick" demo in the package that enables you to move the foot for a meter or so from the animated position based on the offset of the ball).

    When tackling, PuppetMaster can help you animating the ragdoll so the player wouldn't just die on you.

    Hey, I'm suprised you got it working sort of. The thing is I couldn't make it look much better with that WIP behaviour, it needs a lot more work.

    Hey, could you send me a package with that setup so I could take a closer look?

    It's probably the layers. Character controllers usually fly away when they collide with the ragdoll layers or the character controller script raycasts against them. Go to the Layer Collision Matrix and disable collisions between the character controller and ragdoll layers.

    Hey, it's already in my todo list. But in the meanwhile you can see if the last two integration tutorials I made can help.

    Cheers,
    Pärtel
     
  25. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    I've been trying to fix the GettingUp animations and I just can't seem to figure it out, can someone help?
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey, what's wrong with them? Is the character rotating when the puppet is getting up? In that case you just need to disable the character controller while the puppet is not pinned (puppet.state != BehaviourPuppet.State.Pinned).
     
  27. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    The Puppet doesn't even do the Getting up animations...
     
  28. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Do you add the animations to your Animator Controller? Just copy the "BehaviourPuppet" and "BehaviourFall" Sub-State Machine from the "Humanoid Third Person Puppet" controller (in the demo assets) to your own controller and make a transition from "BehaviourPuppet" to your idle animation. Here's a tutorial.

    Pärtel
     
  29. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    If the puppet tries to get up, but repeatedly fails, increase the "Get Up Knock Out Distance Mlp" in the BehaviourPuppet. Also, make sure "Can Get Up" is enabled.
     
  30. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    Hmmh... I'm new to Unity if you wonder why it won't work for me... Haha
     
  31. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    And now the same with PuppetMaster Extended
     
  32. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I just sent you a link to my project in DropBox. I used your website contact e-mail address. Let me know if that is what you prefer.

    Thanks
    Allan
     
  33. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    Can someone do a Tutorial on how to change character for the PuppetExtended? :p
     
  34. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Partel, just wanted to let you know about some minor issues in PuppetMaster:

    There's an issue with the "IK Before Physics (Animator IK)" demo. The dummy just falls over at the start because his Pin Weight has been set to 0.

    Some console errors I'm seeing in Unity 5.3.1f1 on OS X Yosemite from PuppetMaster:

    "JointDriveMode is obsolete" warnings in the Muscle.cs, Prop.cs and PuppetMasterHierarchyAPI.cs scripts on import.

    In the "Melee" demo, thousands and thousands of "Invalid AABB a", "isFinite(d)", "isFinite(outDistanceForSort)", and "isFinite(outDistanceAlongView)" can appear in the console. It seems to be triggered when the other puppet is getting up but it is easier if you try hitting or tripping over it while it's on the ground.
     
  35. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Obsurveyor,

    If you scroll up on this page of thread posts you'll see answers to most of your questions.

    Regarding the JointDriveMode is obsolete warnings, Partel says this:
    Hey, I have already removed those warnings for the next version, but just comment out the lines that produce the warnings and that's it.

    Regarding Invalid AABB, Partel says this:
    Hey, there seems to be a bug with ParticleSystem in Unity 5.3.1, it creates some weird error messages "Invalid AABB result" in the "Melee" and "Puppet Raycast Hit" demos. Just deactivate the "Blood 1" GameObject that has the ParticleSystem for now to get rid of the messages. Trying to figure something out...

    Hope that helps.
    Allan
     
  36. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Alfonso_CJ,

    Here is the link to Youtube for the 5 video tutorials Partel has already released.


    I would recommend watching "Ragdoll Manager" and "Puppet Master Setup". By watching those 2 videos, I was able to create a Ragdoll, Puppet Master version of my own character. I've run into a few hiccups with melee prop setup but nothing out of the ordinary considering the complexity of what we're dealing with here. I would also recommend "Integration Overview" where he goes over setting up a new character with a different character controller than the one included in his package. Also the "Puppet Master Component Overview" is very helpful.

    Keep in mind Partel does not provide instruction for setting up an animated character with complex controller system because that's not what he's selling. But in order to recreate a complex scene like Puppet Extended, you really need to understand the other parts involved. If you're new to Unity as you say, I'll be the first to admit, this is pretty complex stuff because there are a lot of classes and components all working together to make this system work. Being able to take advantage of Puppet Master in a game is going to require strong knowledge of the mecanim animation system and a character control system.

    On second thought, if all you really want to do is swap out the Pilot character in the Puppet Extended scene with your own character model, I'm not sure that's possible. If it is, I haven't been able to figure out how to do that. I usually have to recreate my Puppet Master character setup from scratch each time I make changes to my character 3D model.

    Good luck. :)

    Allan
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi,

    To replace the character in the Puppet Extended demo, it is not so easy, but you can do it by following these steps:

    1. Unparent "Character Controller" from the "ThirdPersonPuppet"
    2. Drag your Humanoid character to the scene, parent it to the "Animation Controller" just where the Pilot is
    3. Delete the "Pilot"
    4. Replace the Avatar in the Animator component of the "Animation Controller" gameobject.
    5. Add BipedRagdollCreator to the "Animation Controller", use it to create a ragdoll, delete the component when done
    6. Delete the Animator from your character root (not the one on "Animation Controller")
    7. Add PuppetMaster to the "Character Controller", click on Set Up PuppetMaster.
    8. Move the "Puppet" and "Fall" behaviours from the old rig to the new one (parent them to the "Behaviours").
    9. Move the "Character Camera" to the new rig, replace the "Target" of the CharacterController component
    10. Use the RagdollEditor (add it to the PuppetMaster) to multiply the mass of the ragdoll by 10
    11. Copy the LayerSetup component from the old PuppetMaster to the new one if you have not set up the layers in the Layer Collision Matrix.
    12. Make sure the new PuppetMaster settings match with the old one, delete the old rig

    I'll add this info somewhere in the scene or better yet, make an editor script that does it in a single click.

    Big thanks, Allan, for the help! :)
     
    montyfi likes this.
  38. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Thank you Partel for making another incredible asset. I remember watching that video a year ago with all the soldiers falling over each other and now it's real :)
     
    Partel-Lang and hopeful like this.
  39. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Just gotta say, PuppetMaster is soooo good. The videos Partel has made barely scratch the surface on what it can do. I've really been digging into it over the last few days and the stuff I've put together is just excellent. Dissecting and re-creating all of his demos included in the package really gives you a sense of how all the parts work together. I even built my own behaviour for making a puppet ragdoll and replaced all the native input stuff with Rewired.
     
    Partel-Lang likes this.
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Wow, thanks guys for dropping by to just say that, means a lot!
    Happy New Year! :D

    Pärtel
     
  41. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Hi all!

    Firstly thank you for your excelent product.

    I am trying to integrate PuppetMaster with Paragon AI and I am having a problem. I have followed similar instructions that used with Opsive TPC, creating ParagonPuppet.cs (similar a OpsivePuppet.cs), my problem is that my agent is always stacked in Falling animation state. I cannot make Regain Balance. Any suggestion?

    Regards
     
  42. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey, thanks for the purchase!

    Is the puppet like trying to get up, but repeatedly failing?
    If so, try increasing "Get Up Knock Out Distance Mlp" in the BehaviourPuppet.
    If not, then make sure "Can End" is enabled in the Fall behaviour and that "Can Get Up" is enabled in the Puppet behaviour.

    Pärtel
     
  43. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Thanks for your kick response. It seems it is not trying to get up, but "Can End" is enabled and "Can Get Up" is also enabled, I will try increasing "Get Up Knock Out Distance Mlp" in the BehaviourPuppet.
    Regards
     
  44. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Ok, this solves the problem, but I have to put a very high value. I was getting mad because putting the double defect value 10 has not result.

    For if it is usefull to someone, the integration script for PuppetMaster and Paragon AI

    using UnityEngine;
    using System.Collections;
    using RootMotion.Dynamics;

    public class ParagonPuppet : MonoBehaviour {

    public BehaviourPuppet PuppetBehavior;
    //public ControllerHandler controllerHandler;
    //public RigidbodyCharacterController character;

    public Transform Root;
    public Transform PuppetMaster;
    public Transform Character;

    private Transform[] objsinPuppetMaster;
    private NavMeshAgent agent;

    private Vector3 NewPos;

    // Called by BehaviourPuppet when balance is lost
    public void OnLoseBalance() {
    // Disable the controller so it would not move while the puppet is active
    //controllerHandler.enabled = false;

    if (Root != null)
    {
    agent = Root.GetComponent<NavMeshAgent>();
    agent.enabled = false;
    }

    // Set upperbody layer weight to 0 so we could play full body animations freely
    PuppetBehavior.puppetMaster.targetAnimator.SetLayerWeight(1, 0f);
    }

    // Called by BehaviourPuppet when done getting up
    public void OnRegainBalance() {
    // Re-enable the controller
    //controllerHandler.enabled = true;

    if (Root != null)
    {
    Root.position = Character.position - Character.localPosition;
    }

    NewPos = Character.localEulerAngles;
    Character.localEulerAngles = new Vector3(0, 0, 0);

    if (Root != null)
    {
    Root.localEulerAngles = NewPos;
    }

    Character.localPosition = new Vector3(0f, 0f, 0f);

    PuppetMaster.position = Root.position;
    PuppetMaster.rotation =Root.rotation;

    agent = Root.GetComponent<NavMeshAgent>();
    agent.enabled = true;

    // Weigh upperbody layer back in
    PuppetBehavior.puppetMaster.targetAnimator.SetLayerWeight(1, 1f);

    // Use with Opsive version 1.1.1 and earlier
    //character.StopMovement(false);
    }
    }
     
    Partel-Lang, GrimDjim and hopeful like this.
  45. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    The problem will probably vanish with the next version of PM, I have improved the getting up code quite a bit. It's about half way there.
    Big thanks for sharing the Paragon AI script! :)

    Pärtel
     
    hopeful likes this.
  46. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I have props working fairly well on my character. Thanks for your help on that.

    Now I would like to work on character damage and reaction to melee collisions but I'm a little bit confused about the behaviours setup and where to start.

    BehaviourPuppet appears to be a sort of foundation class that other behaviours are called from through events.....such as BehaviourFall. My first thought, per the docs, was to create my own behaviour class by duplicating BehaviourTemplate.cs and using that to trigger various animations depending on the hit level (force and mass) of collisions with the ragdoll using the OnMuscleCollisionBehaviour method in that class. And then mix those animations with the ragdoll effects. So I created a duplicate of BehaviourTemplate.cs and called it BehaviourTakeAHit.cs

    But I guess I'm confused because according to your docs and code comments, all additional behaviours remain deactivated and are only activated by BehaviourPuppet. And BehaviourPuppet appears to only have a set number of Events. And none of those events result from evaluating levels of collision, degree of hit or layers causing the collision. So it seems I need to use BehaviourPuppet to evaluate the levels of collision, degree of hit and layers causing the collision and then use that information to trigger an event to call my newly created BehaviourTakeAHit. Or I may just have this all wrong.

    I also noticed that you have a partial class called BehaviourPuppetDamage.cs and I'm wondering if this is an idea you are already working on but have not yet implemented.

    Thanks for your help.

    Allan
     
    Last edited: Jan 7, 2016
  47. Ron-Wilson

    Ron-Wilson

    Joined:
    Oct 2, 2012
    Posts:
    37
    Partel
    Your Assets are brilliant !! Complex to figure out how to implement at least for me but when I get them working on my own characters they look and work great.............your write up for changing out the character in the Puppet Extended Demo took several tries to get working correctly but when it did finally work it worked just as your Pilot character.......
    Its nice to know a Genius like you are writing Assets like this for us to use !!! I bought both Final IK when it first came out and now PuppetMaster...........
    Thank you
    Ron Wilson
     
    Partel-Lang likes this.
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    BehaviourPuppet is sort of a foundation class only in the sense that it activates itself at initiation (I will make it not happen when the component is disabled in the future, if you need to do it now, change "Activate();" in protected override void OnInitiate() in BehavirouPuppet.cs to: "if (enabled) Activate();).

    PuppetMaster currently supports just one active behaviour so if you switch to BehaviourTakeAHit, you'll lose the workings of BehaviourPuppet while it's disabled. If you need to trigger animations/change some PM settings on collision, you can do it like so:

    Code (CSharp):
    1. public Animator animator;
    2.     public BehaviourPuppet puppet;
    3.  
    4.     void Start() {
    5.         // Register to get a call on muscle collision
    6.         puppet.OnPostMuscleCollision += OnMuscleCollision;
    7.     }
    8.  
    9.     void OnMuscleCollision(MuscleCollision m) {
    10.         if (puppet.puppetMaster.muscles[m.muscleIndex].target == animator.GetBoneTransform(HumanBodyBones.Head) // If the muscle hit was the head.. can also use puppet.puppetMaster.muscles[m.muscleIndex].props.group == Muscle.Group.Head
    11.             && m.collision.impulse.sqrMagnitude > someValue) // and collision impulse was great enough:
    12.         {
    13.             animator.CrossFade("Head Hit", 0.2f); // Trigger an animation
    14.         }
    15.     }
    BehaviourPuppetDamage is a actually just a part of BehaviourPuppet, it's a partial class.

    Hey, Ron, good to see you again and thank you for your kind words, it's most humbling! :)
    Just let me know if you have any questions.

    Cheers,
    Pärtel
     
    Last edited: Jan 7, 2016
    umcherrel likes this.
  49. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey!
    Do you maybe have a hint how to let a puppet act like it would walk on a slippery ground (ice for example)? or like it would be drunk? So that he is harder to control to move to the right direction and losing Balance from time to time?
     
  50. Ron-Wilson

    Ron-Wilson

    Joined:
    Oct 2, 2012
    Posts:
    37