Search Unity

PuppetMaster - Advanced Character Physics Tool [RELEASED]

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

  1. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    Is the ragdoll this tool generates a standard unity ragdoll? I don't really need any of the physics stuff, but I'd love a tool that can easily automate the creation of biped ragdolls so I don't have to manually use the unity interface (and would love one to handle quadrapeds as well). Having to do them manually is exceedingly tedious.

    It looks like from one of the videos, at least for bipeds, this is a supported use case.
     
  2. potatojin

    potatojin

    Joined:
    Apr 11, 2012
    Posts:
    23
    Pärtel, it seems like the Final-IK bridge is missing? In the _Integration folder, I only see the Playmaker package; nothing for Puppetmaster.

    EDIT:
    I'm stupid, and was looking for the package in Final-IK, not PuppetMaster. The bridge package is right where it's supposed to be, in the PuppetMaster/_Integration folder.
     
    Last edited: Jan 25, 2016
  3. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Yes. It works pretty good. It recognizes all the right bones. Just add the biped ragdoll creator script to your character - press create ragdoll and then you have a pure ragdoll without the puppetmaster stuff:
    http://root-motion.com/puppetmasterdox/html/page1.html
     
  4. Partel-Lang

    Partel-Lang

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

    Code (CSharp):
    1. puppetMaster.mode = PuppetMaster.Mode.Disabled;
    Yes, you can use it as Der_Kevin kindly suggested. I don't have a tool yet for quadrupeds, its BipedRagdollCreator, but it can still be helpful.

    Cheers,
    Pärtel
     
  5. Filhanteraren

    Filhanteraren

    Joined:
    May 14, 2014
    Posts:
    47
    Hi, I´m trying to use the AimIK system while the Puppet is unpinned ( so it would be full ragdoll ) I Had a look at the 0.3 AimIK integration but it only seem to work good when the puppet is pinned, once it´s unpinned the aiming is off. I have been testing a lot with the IK after physics and while that gets the aiming right you sort of loose some of the ragdoll/physics movement since the IK completely ignores the ragdoll. Anyway, just wanted to see if someone or Pärtel have some ideas how this could be done the best.
     
  6. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I'm working on having the player slip and slide around on ice by combining animation with PuppetMaster and it works very well. One of the reasons why it works so well is because the ragdoll maintains the general momentum/velocity started by the animation. So if the slip and fall animation cause the player to spin when he walks on ice, when he goes into ragdoll, the ragdoll maintains the spin direction/velocity. By engaging ragdoll at different random moments during fall animations I am able to have some fun cool looking slippery ice effects.
    3 Questions:
    1. Ragdoll Momentum/Velocity: Is there anyway to control the momentum/velocity that the ragdoll has when the character loses balance and goes into ragdoll? Is there a way to multiply that momentum? Or do you have it so the ragdoll velocity just equals the character velocity at the time he loses balance and goes into ragdoll.
    2. I have my Ice collider material set to a Zero Friction material. I've noticed that you don't use physics materials on your ragdoll in the demos. I've tried changing the ragdoll collider materials to Zero Friction physics materials in order to achieve a greater slide effect when the player ragdolls but I don't really see any difference. Do physics materials on the ragdoll make any difference?
    3. Not exactly a PuppetMaster question but I could not find an answer in the Final IK forum. I am using EffectorOffset.cs combined with FBBIK to make my character crouch. One issue I ran into is I thought I could just change the Weight value in the EffectorOffset component over time from 0 to 1 to have the player transition from a standing posture to a crouch posture during runtime. But instead the player instantly goes into a crouch posture when Weight is anything greater than 0. So what I have to do in code is set FBBIK weight to 0, set EffectorOffset Weight to 1 and then smoothly transition FBBIK Weight from 0 to 1. It works but it's a little cumbersome. Am I doing something wrong or is EffectorOffset.cs more of a Pose tool?

    Thanks
    Allan
     
  7. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    It doesn't look correct, does it?
    hands_setup.png

    It seems Mixamo characters cannot be easily auto converted. I noticed the problem in FinalIK, because hand was completely straightened it set it up incorrectly.
    It was expected and I fixed it for character controller, but what is the correct way to fix it for puppet?

    Will inverting transform rotation for the right hand be enough?
     
    Last edited: Jan 26, 2016
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey,
    The aim is off when unpinned because it is still trying to follow the animation, but the ragdoll is not facing the same direction anymore. If you'd think of the ragdoll as a single rigidbody, it is still following the pose of the animated character, but since it's rotation is random, not the same as the animated character's, it will miss the target. So you'll have to calculate the target position using a reference to one of the ragdoll bones:

    Code (CSharp):
    1. Vector3 targetRelativeToRagdoll = ragdollPelvis.InverseTransformPoint(targetPosition);
    2.  
    3. aimIK.solver.target.position = animatedCharacterPelvis.TransformPoint(targetRelativeToRagdoll);
    Basically you'll find where the target is relative to the pelvis of the ragdoll. Then you set the AimIK target using that same vector, but relative to the pelvis of the animated character.

    Hey,
    1. It all just happens, asa byproduct of the system, I didn't even have to implement it. Anyway, when you switch to ragdoll, you can just go over all the Rigidbodies and multiply their velocities and angularVelocities by a coeficient.

    2. They do make a difference. Are you using BehaviourPuppet? If so, set up the PhysicMaterials in the "Muscle Group Properties" of BehaviourPuppet. Set something for the defaults and then override for individual groups if necessary.

    3. That is a bug :). Just add
    Code (CSharp):
    1. *= weight;
    to all the lines in EffectorOffset.cs from 25 to 33.

    Hey, I've made a special exception for Mixamo rigs for BipedRagdollCreator. It looks geometric, but It should be fine. Just check the joint limits with the RagdollEditor, and if it's all good, you should be ready to go.

    Umm, I didn't quite understand, what did you mean by" but what iam doing on top with the "puppetmaster" field"?

    Cheers,
    Pärtel
     
  9. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Joint limit on Z axis was inverted, so I just rotated the whole hand transform 180 degree with editor and now it looks similar to the left hand. Visually it started to have less artifacts.
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Oh, you can also just flip the axis with the RagdollEditor. Set Edit Mode to "Joints", select the joint and clikc on "Invert Yellow". Disable Symmetry so the other arm would stay the same.

    Pärtel
     
    hopeful and montyfi like this.
  11. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Didn't notice that functionality, thank you for pointing it out!
     
  12. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I'm an idiot. I failed to see the Puppet and Unpinned physics materials applied to the ragdoll after hitting play.

    I decided to change the ragdoll physics materials directly by accessing the PuppetMaster.muscles array since BehaviourPuppet.cs is not setup to allow you to change the Default Muscle Group Properties physics materials during runtime using an On Lose Balance Unity Event. When you do that it changes the Default physics material in the inspector but they don't change on the ragdoll. That's not really a bug, it's just BehaviourPuppet.cs is not coded to be able to do that so I just went the direct route instead of making the change to BehaviourPuppet.cs.

    Also thanks for the fix to EffectorOffset.cs That worked. :)

    Allan
     
  13. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I'm using the On Lose Balance event in BehaviourPuppet to reset stuff when my player ragdolls. While using BehaviourPuppet, what is the best way to force the character into ragdoll/unpinned mode?

    - If I use behaviourPuppet.state = BehaviourPuppet.State.Unpinned, the On Lose Balance Event is not called, probably because he's not actually losing balance, he's just going directly to an unpinned state.
    - If I use puppetMaster.state = PuppetMaster.State.Dead, On Lose Balance is called but now he's dead. (I can always call a Coroutine with a delay and then switch him back to Alive so this option can work)
    - I can also change his Normal Mode to Active in BehaviourPuppet and then change the PuppetMaster Pin Weight to 0 but then again On Lose Balance is not called because he didn't really lose balance, I just unpinned him.

    Thanks
    Allan
     
  14. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey,
    Dont change behaviourPuppet.state directly, it's supposed to be read-only. I accidentally left it public in the 0.3 submission.
    Use BehaviourPuppet.SetState(BehaviourPuppet.State.Unpinned);

    Pärtel
     
  15. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    Yo guys, I have been searching for these CollisionSounds for a while now and Couldn't find any functionall script and I was just wondering if anyone here would like to share that 1 script? ;)
     
  16. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey,
    Take a look at the FXCollisionBlood.cs (used in the Melee demo on the "Blood 1" gameobject parented to the bot). Basically just replace particles.Emit with audio.Play and you'll got it.

    Cheers,
    Pärtel
     
  17. Roffy437

    Roffy437

    Joined:
    Jan 23, 2015
    Posts:
    24
    Hello Pärtel,

    I recently bought Final IK and Puppet Master and I've handled those crazy plugins.

    I'm trying to rescale a GameObject that have a PuppetMaster component in child, but it works strangely. There is a way to do that?

    And I'm wondering if it's possible to create a ragdoll of a non-biped/quadruped character, for example a creature with 6 legs and a tail?

    Thanks a lot!
     
    Last edited: Feb 6, 2016
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey, thanks for the purchases!
    What do you mean it works strangely? Can you send me a some screenshots of video?
    Because I have tested and used rescaling with PuppetMaster quite a lot, haven't encountered any problems.
    It only supports uniform scaling though and make sure you have "Update Joint Anchors" enabled.

    The BipedRagdollCreator only does bipeds, I don't have a generic version yet, sorry. But you can use it to create most of your 6 legged character. Just assign 4 of the limbs to the References. It's still better than making it from scratch. Then use the RagdollEditor to fix the colliders and joints. I'm planning to add a feature to the RagdollEditor that enables appending at some point in the future.

    Cheers,
    Pärtel
     
  19. AlbertSwart

    AlbertSwart

    Joined:
    Oct 17, 2015
    Posts:
    15
    Hi Partel,

    Do you have any tips for me on how I can effectively combine puppet master / final ik grounder etc. to have a character walk over / on the bodies of fallen / dead characters...as opposed to try and step over or around them. If you have a bunch of enemies on the ground, some collapsed over each other in various poses the collision 'geometry' might be a bit random.

    Thanks,
    Albert
     
    Last edited: Feb 8, 2016
  20. Roffy437

    Roffy437

    Joined:
    Jan 23, 2015
    Posts:
    24
    Thanks for your answer!

    Here an example of simple rescaling (on a demo scene of Puppet Master) :

     
  21. Partel-Lang

    Partel-Lang

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

    You could play around with the layers. When a character dies, you can change the layers of the rigidbodies so that they collide with the character controller and would also be included in the layers of the Grounder.
    You can set PuppetMaster.state to PuppetMaster.State.Frozen to kill those characters. That deactivates the ragdoll so it won't collide (I'll add a toggle for that for the next version), but with a little bit of code it can be done so that the colliders remain, but the Rigidbodies will be made kinematic and PM with all it's behaviours destroyed for the sake of performance:

    Code (CSharp):
    1. public PuppetMaster puppetMaster;
    2.  
    3.     void Start () {
    4.         puppetMaster.OnFreeze += EnableColliders;
    5.     }
    6.  
    7.     void EnableColliders() {
    8.         // Activate the ragdoll gameobjects
    9.         puppetMaster.muscles[0].joint.gameObject.SetActive(true);
    10.  
    11.         // Set the rigidbodies to kinematic to save some performance
    12.         foreach (Muscle m in puppetMaster.muscles) {
    13.             m.rigidbody.isKinematic = true;
    14.         }
    15.  
    16.         // Get rid of the PuppetMaster;
    17.         puppetMaster.OnFreeze -= EnableColliders;
    18.  
    19.         foreach (BehaviourBase b in puppetMaster.behaviours) {
    20.             Destroy(b.gameObject);
    21.         }
    22.         Destroy(puppetMaster);
    23.     }
    Hey, thanks for the video!
    I guess I never tried scaling it that big. :)

    Anyway, when you scale colliders, Unity will recalculate the inertia tensors of their rigidbodies, scaling them up as well, increasing inertia, which will make actuating them more difficult for the muscles. So the answer is just to scale up "Muscle Spring" as well. Also if you wish to dynamically scale in runtime, also enable "Support Translation Animation". Also scale down "Pin Distance Falloff" if you have any.

    Cheers,
    Pärtel
     
    montyfi likes this.
  22. Roffy437

    Roffy437

    Joined:
    Jan 23, 2015
    Posts:
    24
    Hey, thank you :)
     
  23. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Hi, just purchased you PM, I've added a rag doll but some of my joints are 90 degrees off, or is that correct? Can I rotate them?

    Thanks, Kevin

    . Screen Shot 2016-02-11 at 06.53.50.png Screen Shot 2016-02-11 at 06.54.03.png
     
    Last edited: Feb 11, 2016
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey, thanks for the purchase!
    Yes, just add a RagdollEditor component to the root of the character. Then in the scene view you switch from colliders to joints, then you'll have tools to swtich/flip axes easily.

    Here's a tutorial.

    Cheers,
    Pärtel
     
  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey all,

    In case you haven't noticed PhysSound is free on Level 11 sale this month. I haven't tried this myself yet, but I've heard it works nicely with PM. :)

    Pärtel
     
    Griffo likes this.
  26. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang thanks for the reply, I just thought the blue axis alone should be facing forward so the twist of the leg was right/left? swtich/flip axes does two at a time, also I don't see the directional arrows coming out of the rag doll like in your videos.

    Another question I code in Javascript so I thought access to the PuppetMasters variable pinWeight would be ..

    Code (JavaScript):
    1. private var puppetMaster : RootMotion.Dynamics.PuppetMaster;
    2.  
    3. function Start ()
    4. {
    5.     puppetMaster = GetComponent.<RootMotion.Dynamics.PuppetMaster>();
    6.     puppetMaster.pinWeight = 0;
    7. }
    But I get an error at line 6.

    NullReferenceException: Object reference not set to an instance of an object.

    Thanks.
     
  27. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Hi Partel:

    I have noticed a strange behaviour with my puppet. It is controlled by Paragon AI, all correct, but when it is fallen, the puppet:
    1) swipes around ground to reach controller
    2) in that movement while getting up, crosses wall included in collision layers.

    I verify puppet state is Puppet and in that case stop Ai movement in Paragon AI.
    I also tried to disable Navmesh agent in OnLoseBalance and enabled when get up. No luck.

    3) Another cuestion, sometimes Ragdoll hands go a little thought collision layer walls. Collider is perfectly settled. Any adjust?

    Regards
     
  28. Partel-Lang

    Partel-Lang

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

    The blue axis should normally be the one pointing towards the next bone. It doesn't really matter which way. Inverting only means something for the yellow axis, other ones are symmetrical. Anyway, you can also click on "Select GameObject" and set the "Axis" and "Secondary Axis" to whatever you need in the inspector. Axis is the yellow one, Secondary Axis is the green one and blue is the cross product of the two.

    About the script, it just doesn't find the PuppetMaster component, are you sure it's on the same gameobject?

    Difficult to say, because I have not tried Paragon AI yet.
    Does the swiping happen when the character is unpinned or when he starts getting up?
    Is the wall layer also set to actually collide with the ragdoll in the Layer Collision Matrix? Check that in runtime because there might be a script like LayerSetup changing that in Start.
    If you could send me that project, I'd take a closer look.
    3. Do you have "Update Joint Anchors" true in the PuppetMaster? This might happen if its not.

    Cheers,
    Pärtel
     
  29. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Hi, I copied the Puppet GameObject with the BehaviourPuppet script and put it onto my model, it all seem to work fine, but why when I press play the state sets to Unpinned, I have it set a Puppet in the inspector, so the model starts on the floor trying to get up.

    Cheers.
     
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey, that's weird, have not seen this before. I can'r reproduce it, any chance you could send me some sort of a repro?
    Actually the state field there in the latest release was left public by accident, it doesn't do anything to change that in the Editor when the game is not playing.
    PuppetMaster.state is not "Dead" is it?
     
  31. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Sorry my fault I have a blend tree and at the start sometimes the enemy rise from out of the ground so when they do PM will collide with the ground and take sometime to get up, sometimes it did look funny though, and in the end they mostly got up ..

    So I now just disable PM if they choose to come out of the ground until they have risen.

    Kevin.

    Screen Shot 2016-02-12 at 06.32.37.jpg
     
    Last edited: Feb 12, 2016
    Partel-Lang likes this.
  32. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Hi, I've been changing values in script but cannot seem to access the Mode setting.

    I've been looking at your PuppetMaster Component page for the references.

    I use ..

    puppetMaster.muscleSpring = 60;
    puppetMaster.muscleDamper = 0;
    puppetMaster.pinPow = 4;
    puppetMaster.pinDistanceFalloff = 100;

    And they all work fine but ..

    puppetMaster.mode = Active; or puppetMaster.mode = active; or puppetMaster.mode.active does not.

    Kevin.

    EDIT

    OK I use puppetMaster.Mode.Active and get the error

    Expressions in statements must only be executed for their side-effects.

    EDIT

    OK I now know enums are not specific instances of anything so I reference it with a variable

    private var enumModeStatus : RootMotion.Dynamics.PuppetMaster.Mode;

    I then change the value

    enumModeStatus = puppetMaster.Mode.Kinematic;

    But this does not show the change in the inspector but a Debug.Log shows it changes?
     
    Last edited: Feb 12, 2016
  33. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    The particularity in Paragon is that at runtime it separates controller and ragdoll putting both at root hierarchy. So when puppet is fallen, controller is at a location and puppet at other. When puppet gets up, it is swipped around the floor to reach controller. The solution I made was to make that in OnLooseBalance and OnRegainBalance controller transform location equals to ragdoll transform location.
    I have been reached a better solution making controller navmesh setDestination to ragdoll position. And in OnLooseBalance, OnRegainBalance, OnGetUpProne and OnGetUpSupine.

    Since then I have not noticed hands get throught walls.

    Thank you very much for your support.
     
    Partel-Lang likes this.
  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey, it's just:

    Code (CSharp):
    1. puppetMaster.mode = PuppetMaster.Mode.Active;
    Hey, glad you got it working. I'll make more integration packages/tutorial, but in the end, all you need to make sure when trying to make PM work with a third party controller is:

    1. Character controller doesn't collide against the ragdoll bones, nor raycast against them to find ground/obstacles.
    2. Character controller is not moved or rotated while behaviourPuppet.state != BehaviourPuppet.State.Puppet.
    3. Character animation controller doesn't touch Mecanim while behaviourPuppet.state != BehaviourPuppet.State.Puppet.
    4. When the character controller is re-enabled when the puppet regains balance, it must be able to take it's new position/rotation (not snap back to some internal position/rotation) and carry on from there.

    Cheers,
    Pärtel
     
    PicturesInDark likes this.
  35. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Yeah I finally got it, trying to access Mode instead of mode, thanks
     
  36. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Hi, my puppet does a lot of twitching around when knocked over and on the floor before getting up, I've looked at you trouble shooting page and tried a lot of different setting, can you advice me please, thanks.

    EDIT

    I've done all the layers as your documentation advises and it's a lot better now ....
     
    Last edited: Feb 12, 2016
  37. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    It is working with some little strange behavior.
    I have implemented 2 and 4. I will take a look at 1 and 3 and I will say you.
    I think this is interesting because a lot of people will try Paragon and PM and this will be usefull as KB.
    Thank you very much
     
  38. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Hi, I'm having a problem when I re-spawn my puppet he always collapses then gets up before walking off.

    If I just place the puppet in the scene and press play he's fine he walks off and doesn't collapse.

    I've checked that he's being re-spawned on the ground and not dropping onto it, I've also played around with collisionThreshold and collisionResistance but I can't stop him collapsing wen re-spawned, any advice please, thanks.

    Kevin.

    EDIT

    The 2 pictures show the first frame when he's re-spawned and the second frame, in the second the rag doll has become detached ?

    Screen Shot 2016-02-14 at 14.50.53.png Screen Shot 2016-02-14 at 14.51.01.png

    Then he starts to collapse.

    Screen Shot 2016-02-14 at 14.54.14.png Screen Shot 2016-02-14 at 14.54.26.png

    It also happens with the Mode set to Disabled.
    Also happens when using Reset (Vector3 position, Quaternion rotation)

    Should Reset be used when putting the puppet back in the spawn pool or when calling him out?
     
    Last edited: Feb 14, 2016
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey, I've added Paragon to my todo list, but next up is Invector's.

    I think I found a bug with BehaviourPuppet.Reset.
    Please import this patch, it also contains a "Puppet Respawning" demo scene and Respawning.cs for an example.

    Cheers,
    Pärtel
     
  40. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang Thanks for the reply, I've imported the patch but are still having the same problem, I re-spawn the same way as your code, I'll keep looking into it.
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Maybe your PuppetMaster is in Dead state when you respawn?
     
  42. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang OK I was trying to use the Reset() code at the end of the enemy AI script and he was collapsing, I tried it in OnEnble() in the enemy AI script and he was collapsing, so I then put it in the re-spawn script and now he is not collapsing but I now have another problem.

    If i have him in the scene and knock him down the BehaviourPuppet.cs calls OnLoseBalance() then OnGetUpSupine() or OnGetUpProne() then OnRegainBalance .. I have functions in my AI script that they call and all works fine, but if I spawn him and try to knock him down he starts to fall but then springs back up and none of the functions are called .. So OnLoseBalance() is not getting called.

    Kevin.
     
  43. AlbertSwart

    AlbertSwart

    Joined:
    Oct 17, 2015
    Posts:
    15
    Hi Partel,


    Thanks for the answer to my previous question re walking over dead bodies. I have a related follow-up question that I hope will benefit the rest of the community as well.

    When I look at the Grounder Demo that is included in the Final IK package I see that the Pilot depends on a Character Controller. There is also a very good tutorial or two you did on how to go about integrating a Puppet for use with a Character Controller.

    My question I guess is this:

    I have an animated non-player character that walks forward using the root motion of a simple “walk forward” animation. This character will ultimately be controlled by some sort of navigation or AI, but to keep things super-simple let’s just assume this character is a Lemming that only knows how to follow its nose. So I do not need any sort of character controller for it, but I would like to make it a Puppet and I want to use your FBBIK and the FBBIK Grounder so that I can fine tune aspects of the animation as well as walk over uneven terrain with all the goodness that is FBBIK Grounder.

    Character Controllers seem to burst at the seams with all sorts of responsibilities trying to cope with a lot of scenarios like falling and wall running etc., but when it comes to movement the “controller” it’s essentially a Gravity aware Rigid Body attached to a Capsule Collider with a low or zero Friction Material that is being pushed around over or into the terrain. Fairly primitive.

    Puppets are a lot more sophisticated in terms of possibilities, but stripping it down to its core you have a Ragdoll that will attempt to follow along with an animation (given parameters such as pin weights etc.). Assuming the Puppet has no custom behaviours attached and the pin weights etc. is set to fully follow the animation, using a “walk forward” animation (with root motion which remains 0 on the Y-axis) then the Puppet's Ragdoll will collide with or glide over uneven terrain as it attempts to follow our Lemming animation, whom is happily strolling along on Y0.

    Can you think of a simple behaviour that one could attach to the Puppet or any other alternative that would negate the need for a “Character Controller ala Captule Collider” in order to get the FBBIK Grounder work with a Puppet feet for better accuracy?

    Sincere apologies if I just made you read all of this and there is an obvious solution. :-o

    Cheers,
    Albert
     
    Last edited: Feb 16, 2016
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey,
    Sorry I didn't quite understand, did you mean reseting breaks something with the behaviour that normally works and the puppet doesn't get knocked out anymore?

    Hey,
    You should be able to just add the GrounderFBBIK component to the character. Not the ragdoll, but the animated character, just as normal. That would help with the feet a lot. But there would still be some friction going on that you might not like. If you just kept the foot colliders disabled while the ragdoll was pinned, that would do it. Or just keep PuppetMaster.mappingWeight at 0 until there is a collision, thats how BehaviourPuppet does it.

    Cheers,
    Pärtel
     
  45. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel Lang

    I have 3 functions in my code called

    loseBalance() called from OnLoseBalance() on the Puppet from BehaviourPuppet.cs
    gettingUp() called from OnGetUpProne() and onGetUpSupine() on the Puppet from BehaviourPuppet.cs
    regainBalance() called from OnRegainBalance() on the Puppet from BehaviourPuppet.cs

    All work fine if I put my puppet into the scene, but if I re-spawn him then when he gets knocked over none of these functions are called, so it seems that OnLoseBalance() on the Puppet from BehaviourPuppet.cs is not getting called after my puppet is sent back to the pool then re-spawned.

    Kevin.
     
  46. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    @Partel Lang
    Any advice how to make ragdoll for quadruped?
     
  47. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    When that happens, click on the BehaviourPuppet and see if the events still maintain a reference to the script that they are supposed to call those functions on.

    Yes, please see this video, in the last part I'm setting up a ragdoll for a doberman.
    Its still a hack, but the BipedRagdollCreator can still be at least a bit helpful.

    Cheers,
    Pärtel
     
    montyfi likes this.
  48. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
  49. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hey, can you send me a repro or something, I cant reproduce it, in the "Puppet Respawning" demo the events continue to work after Reset. What else happens when you pool the character, do you deactivate it or something like that?
     
  50. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Yes, when I re pool it at the very end of its AI code after its position and rotation is set the same as the pool's it gets deactivated, then when its called for from the pool it is activated again.