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. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Final IK is better suited for specified movements, such as grabbing a doorknob or aiming a gun. While some games have used similar IK system for hit reactions, Puppet Master is a superior solution. So if all you need is hit reactions, you should be good.
     
    designico and Partel-Lang like this.
  2. eelbaz

    eelbaz

    Joined:
    Feb 21, 2015
    Posts:
    19
    Forgive me for the newbie question...

    Can puppet master be used to create simple animations such as walking an running?
     
  3. ncho

    ncho

    Joined:
    Feb 1, 2014
    Posts:
    99
    Is anyone using this with Tactical Shooter AI (Paragon AI), if so, how do you set it up correctly? If I replace the standard Unity ragdoll with this one everything gets messed up and I guess it is because of the dual rig. I have tried to fiddle with the hierarchy but no luck.
     
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hi!

    Yes, you can do it, there is a demo scene included "Puppet Raycast Hit" that does just that.

    Hi!

    No it's not the tool you are looking for.

    Hey, there is a discussion about Paragon here in page 5 that might help you.
    How did you replace the ragdoll? If you already had a ragdoll, you could select it and "GameObject/Convert To ConfigurableJoints".

    Cheers,
    Pärtel
     
  5. SkutteOleg

    SkutteOleg

    Joined:
    Nov 22, 2014
    Posts:
    5
    This is the best asset ever!
    I waited for it for three years and now i'm finally able to make my dream game


    I bet every Unity game will use PuppetMaster now
     
    MIK3K and Partel-Lang like this.
  6. atmosfearteam

    atmosfearteam

    Joined:
    Nov 10, 2015
    Posts:
    42
    @Partel Lang I had another question... What things might I need to sync in order to have PuppetMaster work in a networked game? I don't really see anything related to networking in the demos or documents so I figured I could ask here. I know this probably isn't something you would cover with your asset, but maybe just some tips pointing in the right direction would be helpful. Thanks!
     
  7. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Hi, I'm using MuscleCollisionBroadcaster for a weapon hit but my problem is when I want the puppet to go down if the hit is on the hand it won't go down, if I hit anywhere else, head, body, legs it will go down in the direction of the recast hit and it looks good, I use

    broadcaster.Hit(puppetMasterUnpin, _force, _pos);

    puppetMasterUnpin is set around 100
    _force is rayCastDirection*1000

    That works well and looks good if I hit anywhere else except the hands and lower arms.

    What would be the best way to get the puppet to drop in the direction of the raycast including hitting the hands, I was thinking of checking fir a hit on the hands and if true just move the hit ti the middle body?

    Thanks.
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Haha, hey, that looks fun!
    You might want to try adding more "Muscle Damper" to make them less "springy".

    Hey,
    I have not tried to get PuppetMaster work in a networked game yet, I plan to do it at some point. I've heard it has been done though. It should not be much different from syncing regular ragdolls I guess. But I really can't give you any good hints until I have tried it out myself.

    Hey,
    Check the muscle group overrides in BehaviourPuppet, maybe "Knock Out Distance" is very high like 100 for the Arm/Hand groups.

    Also, if you know the puppet must go down from the hit, you can just call puppet.SetState(BehaviourPuppet.State.Unpinned); after the hit.

    Cheers,
    Pärtel
     
    Griffo likes this.
  9. atmosfearteam

    atmosfearteam

    Joined:
    Nov 10, 2015
    Posts:
    42
    @Partel Lang Oh ok, I will look forward to that then. :) I have it mostly working, just a few issues. One is, I have a cube set as a collider for the ragdoll and I can collide with it and ragdoll once (or maybe twice sometimes) but then if I do it again it glitches out when the character gets back up. I am debug logging the states so I can see what it is doing live, and it shows it correctly going from Puppet to Unpinned to GetUp to Puppet again, but the limbs flail all around when the character should be back to normal Puppet mode and idle. They just keep flailing and I have to restart my scene to get it to stop. But yet it says its in Puppet mode so it doesn't seem like it should be doing that.

    When I just play with one client as the server it all works perfectly fine. Only on another client does it have that behavior. On the server side the character is fine the whole time. Only on the client does it do the flailing. So I'm guessing there is something I need to be syncing that I am not currently.

    That's why I was asking if there was anything special I needed to be syncing. I thought maybe I might need to sync the state field from the Puppet Behavior, but that doesn't seem to help anything. In fact, as I said, it shows it transitioning through the states properly in the debug, but yet at the same time the character is flailing all around. Strange stuff lol.
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    What exactly are you syncing, can you give me the code you are using (you can do that in private if you wish)?

    Pärtel
     
  11. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    71
    Hey Pärtel,

    I just bought PuppetMaster yesterday and I have to tell you i'm totally blown away by how good it is and most of all how easy it is to get up and running! Well done!

    My Unity development is limited to using PlayMaker so i've spent the start of the day trying to create a "Pin Weight" action and a simple action that sets the PuppetMaster state to one of the 3 options.

    I've created a few custom math actions before but I feel i'm out of my depth just trying to get the Pin Weight action going.

    Would you be able to help me with a Pin Weight action please?

    Thanks!

    Simon
     
  12. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    Hi Partel,

    I need your help please.


    I have a "walk" animation (mecanim humanoid) that its chained.
    My humanoid try to walk away but it is captive to the chains and the chain turns stretched/uptight while the human tries to escape.

    Please refer to the video and images to get the hole picture.





    Seconds 34 to 40


    It's possible to achieve what I need with your asset (Final IK or Puppet Master?
    If no, could your please give me some advice?

    Thanks for your help.
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey, thanks for the purchase.
    Try this script (name it PuppetMasterState.cs):

    Code (CSharp):
    1. using UnityEngine;
    2. using RootMotion.Dynamics;
    3.  
    4. namespace HutongGames.PlayMaker.Actions
    5. {
    6.     [ActionCategory("PuppetMaster")]
    7.     [Tooltip("Manages the CCDIK component.")]
    8.     public class PuppetMasterState : FsmStateAction {
    9.        
    10.         [ActionSection("Component")]
    11.        
    12.         [Tooltip("The FBBIK chain type.")]
    13.         public PuppetMaster.State state;
    14.        
    15.         [RequiredField]
    16.         [Tooltip("The PuppetMaster gameobject.")]
    17.         public FsmOwnerDefault gameObject = new FsmOwnerDefault();
    18.        
    19.         [Tooltip("Repeat every frame while the state is active.")]
    20.         public bool everyFrame = true;
    21.        
    22.         private Component component {
    23.             get {
    24.                 if (gameObject == null) return null;
    25.                 go = Fsm.GetOwnerDefaultTarget(gameObject);
    26.                 if (go == null) return null; // This should not happen, but just in case
    27.                
    28.                 // If gameobject has been switched out, need to find new component
    29.                 if (go != lastGo) _component = null;
    30.                 lastGo = go;
    31.                
    32.                 if (_component == null) _component = go.GetComponent<RootMotion.Dynamics.PuppetMaster>();
    33.                 if (_component == null) {
    34.                     Debug.LogWarning("Component of type PuppetMaster was not found on " + go.name + ". Can't apply PlayMaker action.");
    35.                     return null;
    36.                 }
    37.                 return _component;
    38.             }
    39.         }
    40.         private Component _component;
    41.         private GameObject go;
    42.         private GameObject lastGo;
    43.        
    44.         public override void Reset() {
    45.             gameObject = null;
    46.             everyFrame = true;
    47.            
    48.             state = PuppetMaster.State.Alive;
    49.         }
    50.        
    51.         public override void OnEnter() {
    52.             OnUpdate();
    53.            
    54.             if (!everyFrame) Finish();
    55.         }
    56.        
    57.         public override void OnUpdate() {
    58.             if (component == null) return;
    59.            
    60.             var pm = component as RootMotion.Dynamics.PuppetMaster;
    61.             pm.state = state;
    62.         }
    63.     }
    64. }
    65.  
    Hi!

    Actually you can do that with both assets.
    With Final-IK you would just link the hand effectors of a FBBIK component to the ends of the chains. The downside of that is that there would be no real physics taking place so you'd have to fake it somehow.
    With PuppetMaster, you could unpin the arms (and-or the upper body or even the entire character) and just connect them to the chains with joints. I believe it would look better than the Final-IK approach. My only concern is the wackiness of joints in Unity, they might get pulled apart in that long chain unless you use a lot of solver iterations and play around with the mass of the rigidbodies.

    Cheers,
    Pärtel
     
    mkgm likes this.
  14. baneand

    baneand

    Joined:
    Dec 3, 2013
    Posts:
    8
    Hello,

    I have your plugin and it is great! I have a few questions about how to use Puppet Master in some specific situtions:

    1. I have enemy who grabs and slams my main character on the ground. What I usually did earlier is to simply make main character parented to the enemy hand. With puppet master added to my main character this wont work - I am not sure which object to make child of the enemies hand, because there are several objects - puppet itself, character controller and behaviors. I tried to make a configurable joint to the enemies hand, and then attach my character to it, but it behaves springy - lots of rope-like behaviors, looks like he is swinging him with chain or rope, and I cannot make it solid.

    2. Second part is when enemy slams my character on the ground - I add force to the puppet root rigid body (not sure if that is the right way to do this?) and my character gets thrown away, but the physics needs to be more solid - he is behaving like a baloon, falling slowly. If I could maybe set gravity to double while he is being thrown, so that he falls more naturally and faster. Which parameters should I tweek for this? Is this the matter of Unity physics itself? Or maybe there is a better way to do the actual throwing of the character.

    Thanks
     
  15. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    71
    Thank you so much for the script! It works perfectly!
     
    Partel-Lang likes this.
  16. Partel-Lang

    Partel-Lang

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

    1. If you used to just parent the character to the hand, you can continue doing so by parenting the root Transform of the entire character to the hand as you used to. If you need a more dynamic solution with joints, the springiness comes from the processing limitations of Unity physics. You can improve it by increasing solver iteration count and masses of the connected Rigidbodies relative to other rigidbodies connected to it.
    If that doesn't help, you could perhaps send me a video or something to support@root-motion.com so I'd better understand what you are trying to do.

    2. You could add force to or all of the other rigidbodies too. You don't need to increase gravity, it would probably mess up other stuff going on in the game, but you can just add continuous acceleration to the rigidbodies of the character instead.

    Code (CSharp):
    1. foreach (Muscle m in puppetMaster.muscles) {
    2.                     m.rigidbody.AddForce(Physics.gravity * Time.deltaTime, ForceMode.VelocityChange);
    3.                 }
    This script doubles gravity for all the Rigidbodies of the puppet.

    Cheers,
    Pärtel
     
  17. xalsVR

    xalsVR

    Joined:
    Jan 2, 2014
    Posts:
    16
    Hey Pärtel,

    I'm doing a VR experiment on my spare time and I wonder if PuppetMaster could be extended to work with all hand fingers. I know that this could represent too much bones but I'm just doing experiments.

    Thanks bro!
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hi!
    Yes, it could do any hierarchy, but I have not tried specifically fingers yet.
     
  19. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    I have managed to integrate Puppet Master and Tactical/Paragon AI, but only to a limited point. My puppet can't knock down, I have stablished a high value to never happends. But it can reacts to physics, walls and shots.
    I have problems integrating with FinalIK, simply the paragon agent doesn't react to FinalIK. If I have a little time, I am going to send to Partel and proof scene, but I have to find the time. I changed to a new job and it is difficult for me now.
     
  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    Send me the scene, I'll take a look..
     
    PicturesInDark likes this.
  21. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Very busy now. As soon as possible. Thank you for your support
     
  22. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey! Iam currently trying to create my own Character controller. works fine, but i can not get the model replacement functionality adapted to my script. this is the inspector script for the Controller:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4. using RootMotion.Dynamics;
    5.  
    6. namespace RootMotion.Demos {
    7.  
    8.     [CustomEditor(typeof(FootbrawlController))]
    9.     public class FootbrawlControllerInspector : Editor {
    10.  
    11.         private FootbrawlController script { get { return target as FootbrawlController; }}
    12.  
    13.         private GameObject replace;
    14.  
    15.         private static Color pro = new Color(0.7f, 0.9f, 0.5f, 1f);
    16.         private static Color free = new Color(0.4f, 0.5f, 0.3f, 1f);
    17.  
    18.         public override void OnInspectorGUI() {
    19.             GUI.changed = false;
    20.  
    21.             if (!Application.isPlaying) {
    22.                 GUI.color = EditorGUIUtility.isProSkin? pro: free;
    23.                 EditorGUILayout.BeginHorizontal();
    24.  
    25.                 replace = (GameObject)EditorGUILayout.ObjectField("Replace Character Model", replace, typeof(GameObject), true);
    26.  
    27.                 if (replace != null) {
    28.                     if (GUILayout.Button("Replace")) {
    29.                         PropRoot propRoot = script.propRoot;
    30.                         Vector3 localPosition = propRoot.transform.localPosition;
    31.                         Quaternion localRotation = propRoot.transform.localRotation;
    32.                         propRoot.transform.parent = null;
    33.  
    34.                         //doesent work, but needs to work:
    35.                         CharacterPuppetInspector.ReplacePuppetModel(script as CharacterThirdPerson, replace);
    36.  
    37.                         Animator animator = script.characterAnimation.GetComponent<Animator>();
    38.                         PuppetMaster puppetMaster = script.transform.parent.GetComponentInChildren<PuppetMaster>();
    39.  
    40.                         propRoot.transform.parent = animator.GetBoneTransform(HumanBodyBones.RightHand);
    41.                         propRoot.transform.localPosition = localPosition;
    42.                         propRoot.transform.localRotation = localRotation;
    43.                         propRoot.puppetMaster = puppetMaster;
    44.                         propRoot.connectTo = GetRigidbody(puppetMaster, animator.GetBoneTransform(HumanBodyBones.RightLowerArm));
    45.  
    46.                         Debug.Log("You probably need to adjust the localPosition and localRotation of the Prop Root to match this character's hand.");
    47.  
    48.                         UserControlAI[] userControls = (UserControlAI[])GameObject.FindObjectsOfType<UserControlAI>();
    49.                         foreach (UserControlAI ai in userControls) {
    50.                             if (ai.moveTarget == null) {
    51.                                 ai.moveTarget = script.transform.parent.GetComponentInChildren<PuppetMaster>().muscles[0].joint.transform;
    52.                             }
    53.                         }
    54.                     }
    55.                 }
    56.  
    57.                 EditorGUILayout.EndHorizontal();
    58.                 GUI.color = Color.white;
    59.             }
    60.  
    61.             DrawDefaultInspector();
    62.  
    63.             if (GUI.changed) EditorUtility.SetDirty(script);
    64.         }
    65.  
    66.         private Rigidbody GetRigidbody(PuppetMaster puppetMaster, Transform target) {
    67.             foreach (Muscle m in puppetMaster.muscles) {
    68.                 if (m.target == target) return m.joint.GetComponent<Rigidbody>();
    69.             }
    70.             return null;
    71.         }
    72.     }
    73. }
    74.  
    and here is the Controler Script:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.Dynamics;
    4. using RootMotion.Demos;
    5.  
    6.  
    7. public class FootbrawlController : CharacterPuppet
    8. {
    9.     [Header("Footbrawl Settings")]
    10.     public PlayerAction punchAction;
    11.     public PlayerAction kickAction;
    12.     public PlayerAction powerShotAction;
    13.  
    14.     private float lastActionTime;
    15.     private float lastActionMoveMag;
    16.  
    17.     private FootbrawlAnimator FootbrawlAnimator { get { return characterAnimation as FootbrawlAnimator; } }
    18.  
    19.     public float ShootStrength { get; set; }
    20.     public float PassStrength { get; set; }
    21.  
    22.  
    23.     protected override void Start()
    24.     {
    25.         lastActionTime = 0f;
    26.  
    27.         base.Start();
    28.     }
    29.  
    30.  
    31.     protected override void Update()
    32.     {
    33.         if (Time.time < lastActionTime + 0.5f)
    34.         {
    35.             moveDirection = moveDirection.normalized * Mathf.Max(moveDirection.magnitude, lastActionMoveMag);
    36.         }
    37.  
    38.         base.Update();
    39.     }
    40.  
    41.  
    42.     private bool TryDoAction(PlayerAction action)
    43.     {
    44.         if (!CanStartAction(action))
    45.         {
    46.             return false;
    47.         }
    48.  
    49.         FootbrawlAnimator.DoAction(action);
    50.  
    51.         foreach (Booster booster in action.boosters)
    52.         {
    53.             booster.Boost(puppet);
    54.         }
    55.  
    56.         if (propRoot.currentProp is PropMelee)
    57.         {
    58.             (propRoot.currentProp as PropMelee).StartAction(action.duration);
    59.         }
    60.  
    61.         lastActionTime = Time.time;
    62.         lastActionMoveMag = moveDirection.magnitude;
    63.  
    64.         return true;
    65.     }
    66.  
    67.  
    68.     public PropMelee GetCurrentMeleeProp()
    69.     {
    70.         return propRoot.currentProp as PropMelee;
    71.     }
    72.  
    73.  
    74.     public bool CanStartAction(PlayerAction action)
    75.     {
    76.         if (puppet.state != BehaviourPuppet.State.Puppet)
    77.         {
    78.             return false;
    79.         }
    80.  
    81.         if (Time.time < lastActionTime + action.minFrequency) return false;
    82.  
    83.         if (action.requiredPropTypes.Length > 0)
    84.         {
    85.             if (propRoot.currentProp == null && action.requiredPropTypes[0] == -1) return true;
    86.             if (propRoot.currentProp == null) return false;
    87.  
    88.             bool incl = false;
    89.  
    90.             for (int i = 0; i < action.requiredPropTypes.Length; i++)
    91.             {
    92.                 if (action.requiredPropTypes[i] == propRoot.currentProp.propType)
    93.                 {
    94.                     incl = true;
    95.                     break;
    96.                 }
    97.             }
    98.  
    99.             if (!incl) return false;
    100.         }
    101.  
    102.         return true;
    103.     }
    104.  
    105.  
    106.     public bool DoFightAction()
    107.     {
    108.         PropMelee prop = GetCurrentMeleeProp();
    109.  
    110.         if (prop != null)
    111.         {
    112.             return GetComponent<FootbrawlController>().TryDoAction(prop.playerAction);
    113.         }
    114.         else
    115.         {
    116.             return GetComponent<FootbrawlController>().TryDoAction(punchAction);
    117.         }
    118.     }
    119.  
    120.  
    121.     public bool DoShootAction()
    122.     {
    123.         Feet feet = GetComponentInChildren<Feet>();
    124.  
    125.         bool didAction = TryDoAction(kickAction);
    126.  
    127.         if (didAction)
    128.         {
    129.             feet.Shoot();
    130.         }
    131.  
    132.         return didAction;
    133.     }
    134.  
    135.  
    136.     public bool DoPassAction()
    137.     {
    138.         Vector3 direction;
    139.         Targeting targeting = GetComponent<Targeting>();
    140.         if (targeting.Target)
    141.         {
    142.             direction = (targeting.Target.transform.position - transform.position).normalized;
    143.         }
    144.         else
    145.         {
    146.             direction = transform.forward;
    147.         }
    148.  
    149.         Feet feet = GetComponentInChildren<Feet>();
    150.  
    151.         bool didAction = TryDoAction(kickAction);
    152.  
    153.         if (didAction)
    154.         {
    155.             feet.Pass(direction);
    156.         }
    157.  
    158.         return didAction;
    159.     }
    160.  
    161.  
    162.     public bool DoPowerShotAction()
    163.     {
    164.         return TryDoAction(powerShotAction);
    165.     }
    166.  
    167.  
    168.     public bool DropProp()
    169.     {
    170.         PropMelee prop = GetComponent<FootbrawlController>().GetCurrentMeleeProp();
    171.  
    172.         if (prop != null)
    173.         {
    174.             prop.Drop();
    175.             return true;
    176.         }
    177.  
    178.         return false;
    179.     }
    180. }
    181.  
    so in the first script ( FootbrawlControllerInspector)
    the line 35 seams to be wrong. it says:
    Code (CSharp):
    1. CharacterPuppetInspector.ReplacePuppetModel(script as CharacterThirdPerson, replace);
    and i get the error:
    Assets/Player/Pawn/FootbrawlControllerInspector.cs(35,49): error CS0103: The name `CharacterPuppetInspector' does not exist in the current context

    do you know what i did wrong there?
     
  23. Arsinx

    Arsinx

    Joined:
    Apr 14, 2014
    Posts:
    55
    Hello,
    I am strongly thinking of buying this asset, I need to do ragdoll physics for character, However I want to know it is possible for the character to walk loosely following an animation, and have loose arms for example that pirouteee around when the character rotates using this asset, or have a bobing head(sort of)
    Also, I want to know if this will work reasonably in a networked game.
     
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hi!

    FootbrawlControllerInspector is an editor script so you need to move it to an "Editor" folder.

    Hey!

    Yes, you can define how much exactly you wish to constrain the puppet to it's animation and set pin/muscle weights for each individual muscle. So you could for example pin the lower body to the world space animation and leave the upper body unpinned to play only using the muscle torques.
    Users have reported having successfully networked puppets. I have not tried myself yet, but it's in my short term todo list.

    Cheers,
    Pärtel
     
    hopeful likes this.
  25. Arsinx

    Arsinx

    Joined:
    Apr 14, 2014
    Posts:
    55
    Thank you for your quick reply, would it be possible to get in touch with someone who has done networking with this asset, so that I can ask them for some quick tips ?
     
  26. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Damn, ive spent the last two days checking for spell errors and reading the docs up and down and that(!) was the mistake :D thanks! :)
     
    Partel-Lang likes this.
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey, actually I just started working on the networking demos :)
    I hope to be done with some examples and codes shortly..

    Pärtel
     
    hopeful likes this.
  28. Arsinx

    Arsinx

    Joined:
    Apr 14, 2014
    Posts:
    55
    ^Alright Ill wait for youre Demos :)
     
  29. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    @Partel Lang, could you please suggest how to solve this problem:
    Two characters, I'm using OnCollisionImpulse like in your melee example to show FX when one character kicks another one. The problem is that OnCollisionImpulse kicks in both directions, when character kick itself and when it is kicked by another one. What would be a good way to differentiate those, I want to show FX and decrease health only for the one, that was kicked, but not on kicker.
     
  30. kdodman

    kdodman

    Joined:
    Apr 2, 2016
    Posts:
    5
    I have networked my puppermaster characters. But I would not say I did it efficiently, I simply send all bone transforms. Uses massive bandwidth, but it works, for now.

    Very glad to see that Partel is working on networking. Hopefully he will have implementations for Unity Networking and PUN
     
  31. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    Hello,
    is Puppet Master possible to be integrated with Oootii Motion Controller (v2)? It does not use capsule collider for character control, so I am curious whether it would work with your ragdoll system.
    Best!
     
  32. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Even more, it contains integration scripts and demo!
     
    arturmandas and Partel-Lang like this.
  33. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hi!

    You could for example check if the root Transform of the collider in the collision is the same as your character's root Transform:

    Code (CSharp):
    1. void OnCollisionImpulse(MuscleCollision m, float impulse) {
    2.             if (m.collision.transform.root == mainCharacter.transform.root) Debug.Log("This puppet just hit the main character.");
    3.         }
    Anyone here interested in testing my network demo before I release it to the wild?

    Cheers,
    Pärtel
     
    montyfi likes this.
  34. arturmandas

    arturmandas

    Joined:
    Sep 29, 2012
    Posts:
    240
    Thanks! I'm putting it on my To-Buy list :)
     
  35. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Unfortunately it's not exactly work.
    My player (only the one who has that script on it) stays still.
    Enemy attacking by fist, crashing player.
    BUT, player's OnCollisionImpulse reports m.collision.transform.root == enemy
    The reason, perhaps, muscles receives impulse from that hit by enemy. Am I right?
    Do I need to set some bool at start of the action and clear it at the end? I know how to do it for prop, but I have no idea how to do it for bare hands/legs.
     
  36. redfrizbee

    redfrizbee

    Joined:
    Apr 18, 2016
    Posts:
    3
    Hello Partel, This is Red Frizbee Studios. Thank you for the great work so far on PuppetMaster. Very good to hear that you are working on networking as well. We are always interested to test out any improvements you have made.

    We don't have any videos up yet of using PuppetMaster but our website is http://www.redfrizbee.com. Again, thanks for the most excellent work on both PuppetMaster and FinalIK.

    Lee
     
    one_one likes this.
  37. Arsinx

    Arsinx

    Joined:
    Apr 14, 2014
    Posts:
    55
    I would love to test it :D
     
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    If a collision happens between 2 puppets, it goes to OnCollisionImpulse of both of them. So if it's your character that you need to damage from enemy collision, check if (m.collision.transform.root) == enemy and if true, decrease health by impulse magnitude (the puppet collided with an enemy collider, collision.transform belongs to the other puppet). On the enemy you can do the other way around and check if root is the player.

    Hey, I'll have some networking stuff ready next week if all goes well so stay tuned..

    Cheers,
    Pärtel
     
  39. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Thank you, I will try that, perhaps I misunderstood something.

    One more question, I'm trying to understand how booster works. I can see you execute booster.Boost(puppet);
    But for how long it will be boosted? Do I need to set some variable, or do I need to call something to cancel boost?
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    In BehaviourPuppet there is a "Boost Falloff" that is the speed at which immunity and impulse multiplier will be back to zero. 1 is 1 second until the boost effect is gone after calling Boost.
     
    montyfi likes this.
  41. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Thank you again, it seems you thought about everything!
    Is it possible to make BehaviorPuppet work on generic character with humanoid bones? OnCollisionImpulse is not getting called on it, perhaps I'm missing some important step?
     
  42. ZenMicro

    ZenMicro

    Joined:
    Aug 9, 2015
    Posts:
    206
    Hi Partel,

    (First Time Poster here :p) I've been keeping an (loose) eye on Final-IK since I first discovered it a while back and have since dabbled a little with IK and also setup my own Mecanim Controller based on the Unity Tuts and some other Tuts... but overall have only got simple stuff and it's a bit clunky and kind of a mess :p

    Can you help me understand what I need to really get a serious setup to accomplish what I want? Now that you have PuppetMaster I am slightly more confused as FIK and PM are similar but the former is focused on the IK and the later on the Physics If i'm not mistaken... But still neither provides the Mecanim (MoCap) system for handling the animation controller am i right?

    Do I need to get a good Animation Controller first? (I know you have Ootti's offerings as a confirmed collaboration)

    Is Final-IK perhaps the best starting point or is PM going to eventually replace FIK? (I know you mentioned a suite)

    What I am need is for the player to use IK to put her hand on the car door handle, then trigger the open action (Currently my doors use a physics spring to open/close with forces akin to reality.. looks fine.. but has nothing to do with the player) I have an open door animation but the player tends to lunge forward into the car (as you are likely already standing close.. so might need to step backwards first?) and of course there is no actual awareness between the door and the player apart from door state and player current animation 'one-shot' play - Currently i removed the collider from the door as well so it's just visual)

    Then would come the next step where you enter the vehicle (a separate sequence) if you decide to enter (click on the seat) a sit animation plays and you should end up on the seat transform designated)...it's a mess really.. I have the pieces of the puzzle but it's so disconnected - I mean the enter vehicle animation is like climbing into a low sports car, but my vehicle is a van and should be more like climbing into a truck.

    Then like your IK video of the driving with hands on the wheel I figure is a walk in the park (until you want to handle realistic full opposite lock steering where you might use one hand to 'palm' the wheel like you might drive a truck or bus, you know for fast turns.. currently the wheel turns correctly but by itself... player has not connection)

    Also is there a discount for purchasing both assets? (really wish i had snapped up FIK last time I saw it on sale!!!)

    And finally.. just for fun... Can your stuff handle Self-Awareness such as center of balance like this? (a little ways into the video on the Ice)


    Thanks!
     
  43. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Which ai solution would you guys reccomend for puppetmaster? Behaviordesigner, nodecanvas, emerald, behave? Something else? Is there a Solution which already supports puppetmaster?
     
  44. kloogens

    kloogens

    Joined:
    Jul 1, 2015
    Posts:
    109
    Not sure what level your coding skills are at but.....
    Consider adding states to your characters, the state should distinguish the action the character is taking. So , in your example you may want a "kicking" state or "right leg kicking", "left leg kicking" depending on your needs. When a collision occurs you look each characters state to determine who takes damage. So lets say you have two characters A, and B. B is just standing waiting to get kicked by A. On the collision you check the state of A (should be kicking state) and check the state of B , lets says Character B is in an "Idle" state because as stated B is just standing there waiting to get kicked. Now you know who's doing what and how to respond. Furthermore, if A and B are kicking at the same time then they each would do damage to each other because their both in a kicking state. You could also extend this and add a "blocking" state , that either prevents or reduces damage from an attack. This is pretty simple, the damage system I use for my games is much more complex and harder to explain, but I hope this helps.
     
    Last edited: Apr 21, 2016
  45. kloogens

    kloogens

    Joined:
    Jul 1, 2015
    Posts:
    109
    I have a character in the back of an AI guided pickup truck. I'm snapping the character to a collider that represents the bed of the truck. That way the character can be in the back of the truck when it moves. I got this working just fine. However, with puppetmaster, the character stays snapped just fine at very low speeds. When the truck goes faster the character begin to slide around, but always gravitates back to the snap position. When I disable puppet-master , the snapping works perfectly. Soooooo.... I was wondering if anyone knows how to nail the characters feet down so it doesn't slide around without disabling puppetmaster. I would also like to unnail their feet when they die so regular puppet master behavior can take over.
     
  46. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hi!

    Make sure muscle groups are set up right in PuppetMaster for each individual muscle.

    Hi!

    PuppetMaster will never replace Final-IK. They are basically like brothers, Final-iK works kinematics, PuppetMaster works dynamics. (Maybe I should have named it Final Dynamics ;)). They can be used together.

    The door stuff you mentioned can be done with Final-IK, if you have an animation of a character entering a car, I suppose you could use animated effector position offsets for the hands, body and feet to make that animation suitable for every car you got. Then once he's in, you can pin his effectors to the wheel, seat and pedals. You can animate those effector targets to do gear shifting and stuff like that.

    I can't do a discount for purchasing both assets, sorry, the asset store doesn't support stuff like that. I had and upgrade from Final-IK to PuppetMaster at the beginning but it merged ratings and reviews between the two so I had to remove it. There will surely be more sales though in the future if you're not in a hurry.

    The last question, not exactly like that, I have a preview of the balance behaviour in PuppetMaster, but that can't be used for walking, just idles.

    Hi!

    I have not used any of them yet, so I don't know at this time, sorry. Maybe someone else has tried.

    Hi!

    What exactly do you mean by "snappin" are you parenting it or using joints or..?

    Cheers,
    Pärtel
     
    ZenMicro likes this.
  47. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Works with ICE surprisingly good.

    Yes they are, I can even boost them, but the same script with OnCollisionImpulse that works for the main mecanim character doesn't work here. I will experiment more today.
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    You'll also have to swap the animations in BehaviourPuppet and BehaviourFall sub-state machines in the animator controllers to some generic get up/fall animations.

    Play the scene and tell me if the MuscleCollisionBroadcaster.cs component has been added to the ragdoll's bones by the PuppetMaster.
     
  49. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    This is the problem, because I don't have them at all, so I removed those from behavior puppet. But I assume it should not be a problem, at least it doesn't generate any errors.

    I'll try that at evening today and report back, thank you for help.
     
  50. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    @Partel Lang, it is working OK now, both puppets receives OnCollisionImpulse, but the old problem is back. When one of them hits, OnCollisionImpulse almost all the time fired on both symmetrically.

    Debug.Log(transform.root.name + ", enemy: " + m.collision.transform.root.name + ", muscleIndex: " + m.muscleIndex + ", impulse: " + impulse + ", time: " + Time.time);

    Results:
    MCSFemale Root, enemy: MINOTAUR Root, muscleIndex: 5, impulse: 47.7226, time: 1.3
    MINOTAUR Root, enemy: MCSFemale Root, muscleIndex: 11, impulse: 47.7226, time: 1.3

    MCSFemale Root, enemy: MINOTAUR Root, muscleIndex: 5, impulse: 24.00461, time: 4.14
    MCSFemale Root, enemy: MINOTAUR Root, muscleIndex: 5, impulse: 337.384, time: 4.92
    MINOTAUR Root, enemy: MCSFemale Root, muscleIndex: 11, impulse: 70.13435, time: 4.92


    EDIT.
    OK. Checking puppet.puppetMaster.muscles[m.muscleIndex].state.impulseMlp did the job.
     
    Last edited: Apr 22, 2016