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,550
    Hey,
    Could you try just setting additional pin weith to 0 while the weapon is being hold by both arms?
     
  2. Vixelv

    Vixelv

    Joined:
    Aug 9, 2013
    Posts:
    2
    Thank you for the response.
    Setting an additional pin weight to 0 reduces trembling, but weapon becomes lightweight, hitting doesn't affect the enemy ragdoll, rotation lag occurs.
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    How is the left hand connected to the weapon, using a Joint of some kind?
     
  4. killerjim

    killerjim

    Joined:
    Sep 14, 2016
    Posts:
    10
    I've a question on networking of PuppetMaster entities..

    Our game already has multiplayer working fine, but we've moved to use PuppetMaster for our enemy NPC's; this is working great in single player.

    However, in our existing network implementation the server just sends out animation information for each NPC, so that on all remote clients they stay "in sync". They can only shoot them so it's fairly simple for the server to move, change animations, etc. and broadcast..

    With PuppetMaster non-server players can do much more than just shoot a NPC, they can now slap them around, knock them over, etc. and we need to transfer this over the network so everyone see's the action "in sync" with the player performing the operation (never mind two players slapping around the same NPC...)

    Do you have any information on best practice here?
    Are there any points on how to transfer the puppet master state?

    I know this is a major topic, something that's going to cause us untold misery but any help would be appreciated.
     
  5. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @Partel-Lang

    I'm starting with Puppet Master. I'm with the Ragdolls edition and the following problem occurs to me.
    I do what the documentation and VideoTutorial say. But when I enter "Edit Mode -> Joints", I see the axes of the constraints, and they seem to be set badly. I have tried to correct them with the options of "Switch .... colors" and "Invert Yellow". But I have not been able to correct them.
    I've looked at some of their example scenes to see if the limitations of the Joints were right on them. But the ones I've looked at also seem to get down badly.
    The limitations may not be wrong, but the placement and arc of each color are confusing and appear to be wrong. Attached photos
    PuppetMasterLimitsProblem.jpg

    PuppetMasterLimitsProblem2.jpg
    What causes this error? How should I fix it? ... If it is a mistake ...
    I'm looking at his tutorials but I can not find anything to help me.

    Another question: Where is "Flat/Tree Hierarhcy" from the PuppetMaster's context menu? I'm following the manuals and I can not find it

    Another thing is how I can correct the rotation of the colliders when creating the Ragdoll in some Characters
    PuppetMasterCollidersRotProblem.jpg

    regards
     
    Last edited: Aug 18, 2017
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey.
    There is a UNet getting started package included under Plugins/RootMotion/PuppetMaster/_Integration, but it is a non server authoritative example. If you are looking for server authoritative, I suggest you try this approach:

    Set knockOutDistance to Mathf.infinity on all the client instances of BehaviourPuppet.
    Use the "On Lose Balance", "On Get Up Prone" and "On Get Up Supine" events of the server puppet to RPC them over to the clients and on the client side call behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned) for "On Lose Balance", also set behaviourPuppet.canGetUp to false on that event. Then call behaviourPuppet.SetState(BehaviourPuppet.State.GetUp) on the client for the "On Get Up Prone/Supine" events and set canGetUp to true. That way the client puppet states will depend on the server.

    Hey,
    The joint limits are by default set looser than would be biometrically accurate just to support a wider range of motion for the animation, because in many cases, animation also defies biometrical joint ranges and that might create problems when the puppet is not able to follow animation to the full extent with "Angular Limits" set true in PuppetMaster settings. You should not need to adjust those joint limits unless you see the ragdoll bend or twist unnaturally.

    About Flatten/Tree, right-click on the header of the PuppetMaster component and you'll find them in the context menu that opens.

    Concerning the rotation of the colliders, that is a problem with the model, the Ethan dude just has messed up bone orientations. It is not possible in Unity to change the rotation of the colliders. If you really need to use that broken character, you can add child gameobjects to those mis-aligned bones and move the colliders to them. Then you'd be able to rotate those child gameobjects.

    Cheers,
    Pärtel
     
  7. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Thanks for the reply.

    Another thing ... I need the titre Ragdolls not to collide with objects that have a concrete tag.

    How can I do that? Is there a way to put in the PuppetMaster component a public variable to tell you from there what layers or tags you want to ignore?

    regards
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    Just put the concrete objects on their own layer and exclude collisions between that and the ragdoll layer in the Layer Collision Matrix under Physics Settings.

    Best,
    Pärtel
     
  9. Infrid

    Infrid

    Joined:
    Jan 14, 2012
    Posts:
    67
    Hello,

    not much mention of layer setup in the docs. zilch whatsoever in terms of puppet creation and editing. Then, when I open up the demo scenes in my project, which has a bunch of layer-pyshics configurations, puppets fall through the floor when set to dead state.

    any more info on that topic? not sure what should be set to what, and how the layers should be configured.
     
  10. Infrid

    Infrid

    Joined:
    Jan 14, 2012
    Posts:
    67
    also, layer number's instead of names in the inspector is _not_ what I expect after paying 100 bucks - I hope the amount of pita things like that is a minimum; but was surprised to find that out within my first 5 minutes with the package.
     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    When you puppets fall through the floor when set to dead state or stuff like that, it is probably because the package was imported to an existing project with already edited layer settings that differ from the default. Try importing to a new project.

    As far as layers are concerned, there is only a couple of things to consider:
    1. The ragdoll and character controller layers must be set to ingore each other in the Layer Collision Matrix
    2. If you don't want something else to collide with the puppet, set it's layer to ignore the ragdoll layer.
    3. If using BehaviourPuppet, you'll need to assign it's "Ground Layers" and "Collision Layers". The former is used to place the character vertically when getting up, the latter should contain layers that ought to damage the puppet on collision and cause it to lose balance.

    As for using layer names instead of numbers, I really can't use a LayerMask there, it would enable you to choose more than one layer, but I need you to choose just one.

    Cheers,
    Pärtel
     
  12. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    I started with _DEMOS/Killing.scene, and the scene works as expected. I replaced the camera with a SteamVR camera and instantiate the existing ball when I pull the trigger, and also put some rigidbody cubes in the scene. I can shoot the cubes with the ball, and knock them around, but when the balls bounce off the dummy, they never knock him over now, though I see him flinch. What setting am I missing that I need to tweak for the dummy to properly respond?
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    When you LMB in that scene it shoots some balls at the Dummy using the BallShooter script, they damage him and sometimes knock him over. Did you use the same ball prefab? Perhaps the layer of the ball is not included in BehaviourPuppet's Collision Layers.

    Best,
    Pärtel
     
  14. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168
    Hi Partel,

    I'm an happy owner of Final Ik and PuppetMaster. My whole gameplay is based upon them for an important project for a quite famous french music band. That's for the presentation :)

    I'm running into a glitch and I don't know if this is my fault or if there is actually a glitch inside the code of puppetmaster.

    I have 4 characters and 3 of them have props incorporated inside their skeleton, like in this one :



    Basically this is my workflow for setting up puppet master on my characters : I put the ragdoll with the ragdoll editor. Then, with this character for example, I add to the earring bone the capsule and the confugurable joint, attached to the head bone. Now, if I hit play, everythning's working fine on my ragdoll. Then, I add the puppetmaster script. In it's settings I put -on- "Internal Collisions" and "Angular Limits". I put the humanoid boxing animation on it, or any animation where the colliders would internally collide. And it's glitching, like, a lot. If I remove Angular Limits it's working again.

    If you need more details for helping me, I'm here.
    Thanks in advance and have a nice day,

    Jonathan



    Edit :

    Another image, just to show the glitch :



    The left arm is jittering a lot.

    Also, the problem seems to be solved by putting the prop out of the humanoid skeleton and using the props script. But this solution is really not convinient.
    So, the problem does not comes from angular limits settings on my configurable joints.

    Edit 2 : I think this has actually nothing to do with props, but with

    Edit 3 : I saw a similar issue on the previous page on this forum @
    Alfonso_CJ. So I checked a bit more the angular limit, and the joint orientation are actually messed up (but the limits are good), I guess it has something to do with mixamo then (the last update maybe ?) I'm gonna invastigate.
     
    Last edited: Sep 11, 2017
  15. AlexKassabian

    AlexKassabian

    Joined:
    Apr 24, 2017
    Posts:
    2
    Hi Partel,

    How would one go about adding an explosive force against the puppet?

    Thanks!
     
  16. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    good question
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    Does that jitter happen with any animation or just some points at some specific animations like that boxing?
    If it does, could be that the joint limits just don't allow for enough range of motion to follow that animation and the limits need to be extended.
    Also, what are the props, the earrings?

    Hey,
    If you are using BehaviourPuppet, call
    Code (CSharp):
    1. behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned);
    , then foreach through all puppetMaster.muscles and call AddExplosionForce() on each muscle.rigidbody.

    Best,
    Pärtel
     
  18. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    Is there any way to get the aim IK component to aim at a target like "World" instead of Local like? Desktop 2017.09.13 - 12.31.54.01.png I want the arm to aim down at all times no matter what. Thanks.
     
  19. Alfonso_CJ

    Alfonso_CJ

    Joined:
    Nov 19, 2015
    Posts:
    35
    So I kind of figured it out but not quite exactly how I wanted it to end up GIF9GAG215.gif
    I set the puppet bones instead of the Animator bones to the Aim IK component is there any other Solutions?

    But I still got some good shots GIF9GAG208.gif GIF9GAG213.gif

    If the bones were taken from the Animator would it still have the Collision conflicts seen in 'figure 1'?
     
    TibiTibith likes this.
  20. haydin20

    haydin20

    Joined:
    Sep 18, 2015
    Posts:
    3
    Hi,

    i sent this problem with e-mail. But i want to share in there. Maybe for other people need this problem's solution.

    i have got a problem with PuppetMaster. On video time set to 0.3. i opened humanoid config demo scene. front puppet disabled mapping weight. Its play only animation without jitter and very smooth. Rearward puppet playing mapping weight enabled. Rear puppet has got jitter when playing.

    I tried to set interpolate rigidbody objects. When i set some part (Hands and foots) jitter different type.



    Does anyone have an idea for this problem.

    Edit: If you watch the video on Vimeo you can understand better
     
    Last edited: Sep 15, 2017
  21. killerjim

    killerjim

    Joined:
    Sep 14, 2016
    Posts:
    10
    I'm looking into "chopping up" a model when using melee weapons, ie. chopping off arms, legs, etc..

    I had a quick go at removing a muscles at run-time, but there's obvious internals at work which cause errors and the puppet to "unpin" (drop to the floor, minus the muscle I removed)..

    Any tips on the best way forward here?

    I appreciate I'll be changing the internals of puppet master but any pointers on how best to reinitialize the puppet that's now missing muscles (and associated 1:1 bones on the model) would be appreciated!

    The more information you can give me the better, I'll share the changes back to you once I'm done :)

    - James
     
  22. Partel-Lang

    Partel-Lang

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

    You'll need to convert the position of the AimIK's target from muscle space to animation space.
    Please import this package, made a demo for you.

    Hey,
    It just that when the character is mapped to ragdoll, it will update at the same frequency as the ragdoll, which is whatever you have as the Fixed Timestep in the Time Settings under Project Settings.

    Turning on interpolation helps with that, but there are multiple ways to do that. I'd recommend you to right-click on the PuppetMaster component's heading and select "Flatten Muscle Hierarchy", then set all rigidbodies under it to interpolate. If the hierarchy is not flat, interpolation of the pelvis carries on to it's children which also have interpolation so those interpolations might "conflict" with each other, resulting in jittery motion.

    Hey,
    How exactly did you remove the muscles? Have you seen the "Removing Muscles" demo? Did you use the same technique (as in SkeletonShooter.cs)?

    Best,
    Pärtel
     
  23. haydin20

    haydin20

    Joined:
    Sep 18, 2015
    Posts:
    3
    Hi,

    Thank you for support. This solution solved my problem.
     
  24. Deleted User

    Deleted User

    Guest

    Hello, im lucky to say i have Buy and Download Puppet Master, i love it!

    I got a little problem with my first Puppet Master setup.
    Im using the Third Person Character Controller from Opsive and to integrate Puppet Master was really easy but my Puppet behaves a little strange when he falls down and try to stand up on odd terrain.
    puppetMaster.gif
    I think there is something wrong with the Joints, i dont know..

    And also i have a suggestion, what about a Drunk Puppet Behaviour, something with strange relative motions, or more like a Kid Puppet Behaviour who just learn to walk
     
    Arganth likes this.
  25. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    I'm having an issue following the respawn demo. I use the Reset function as well as the play animation function just like the demo, but maybe 1 out of 10 times he'll fly into the air after respawning. Is there a guaranteed way to prevent this?

    Edit: Strong arming it seems to solve it for now. Did this after Reset and targetAnimation.Play:

    foreach (RootMotion.Dynamics.Muscle m in puppetMaster.muscles)
    {
    m.rigidbody.position = m.targetAnimatedPosition;
    m.rigidbody.rotation = m.targetRotationRelative;
    m.rigidbody.velocity = Vector3.zero;
    m.rigidbody.angularVelocity = Vector3.zero;​
    }

    Double Edit: While it helped, it still flys out of nowhere sometimes... rarely but sometimes.
     
    Last edited: Sep 18, 2017
  26. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    315
    Is it possible to use Unity's "Animation Performance Recording" to capture Puppetmaster stuff as animations? Same goes for Final IK too. I've not used this yet, I think it's still marked experimental, but the thought has certainly crossed my mind more than once.
     
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    I've never seen such a problem. Any chance you could send me a repro so I could take a closer look?

    Hey,
    The Reset thing was completely restructured for the next version and replaced with PuppetMaster.Teleport, which is a much more reliable method. I'm close to releasing the next version, but please send me a mail to support@root-motion.com with your invoice number if you'd like to have that right away.

    Hey, did you mean this or something else?
    Anyway, you can use a recorder with PuppetMaster as long as it enables you to choose when in the update order of things to take the snapshots. It should be done in the PuppetMaster.OnWrite delegate.

    Code (CSharp):
    1. void Start() {
    2. puppetMaster.OnWrite += OnPuppetMasterWrite;
    3. }
    4.  
    5. void OnPuppetMasterWrite() {
    6. // Record a frame here
    7. }
    Final IK is easier, as you can choose when to update the IK instead.

    Best,
    Pärtel
     
    tapawafo likes this.
  28. Deleted User

    Deleted User

    Guest

    I found it out, i got a Capsule Collider under the Player Hierarchy marked as Trigger, next to the Player Mesh was a environment trigger, i got him now under the Player Root and its working perfectly fine.

    Thank you


    EDIT:
    It was not the Trigger, it was the Physic.IgnoreCollision in a script that makes the Player Collider ignore the collided object, this is not working on OnLoseBalanceFromGetUp in the BehaviourPuppet
    I fixed it by make the collider see the Player collider collision in the OnLoseBalance event

    So what i did was Setting all Environment to the Default layer in and assign in the BehaviourPuppet of my Character the CollisionLayers to Default.
    The Ground Layer of the Behaviour to a unused Layer
    And created a Trigger, a little bigger then the player collider and parent it to the Player GameObject.
    Make a script that understand when you run in something that is not under your feet then let them ignore the player collider with the trigger so that the Ragdoll handles all collision even when you just run
     
    Last edited by a moderator: Sep 19, 2017
  29. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    315
  30. Fairennuff

    Fairennuff

    Joined:
    Aug 19, 2016
    Posts:
    88
    Hi @Partel-Lang

    I updated to the latest version of puppetmaster and have an issue. When I call puppetmaster.kill() my puppet now launches into space. I *think* this is due to the new feature listed in the release notes -
    - Animated momentum will be transferred to the rigidbodies when switching from Kinematic to Active mode. Will enable you to set state to Dead immediately from Kinematic mode and still preserve animated momentum.

    Reason for my suspicion is this is the only new feature I can see that may cause it and I am using Kinematic mode and using the .Kill() method which switches to dead. If I sneak up behind my enemies and knock them out it acts normal. If they are running at me though and I hit them they shoot off. Or sometimes when I hit them really hard (VR game) or throw particular items at them that call the kill method I have this issue. The puppet is on a layer that ONLY collides with my player's hands and the ground/default layer. I've tried turning on/off and playing with all the settings I can find and still can't resolve this issue.

    is this a feature I can control/turn off/damp?

    I did shoot you an email but I was close to a live demo when I ran into this so reaching out here as well.

    Thanks as always!
     
    Last edited: Sep 21, 2017
  31. oded

    oded

    Joined:
    Jun 7, 2013
    Posts:
    10
    I'm new in puppetmaster I'm trying to incorporate it into my game
    I'm using playmaker When the player With puppetmaster enters trigger in play maker tag player
    He does not respond Only with tag untagged is respond
    The player responds perfectly Except for this problem 1.jpg
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    If you went to PuppetMasterStates.cs and commented out lines 190 and 191:
    Code (CSharp):
    1. m.rigidbody.velocity = m.mappedVelocity;
    2.                 m.rigidbody.angularVelocity = m.mappedAngularVelocity;
    Would that make the problem go away?

    Hey, which gameobject do you have the Player tag on? Does that gameobject have a collider?

    Best,
    Pärtel
     
  33. Fairennuff

    Fairennuff

    Joined:
    Aug 19, 2016
    Posts:
    88
    It does not appear to fix it. Should I be concerned that those 2 lines of code were not on 190 and 191 they were on 176 and 177...?

    Edit: It appears if I disable my animator before calling the kill method it works as intended. Previously I did not need to do this - The kill method disables the animator for you as it does in the Demo scene.

    This is an issue for a few reasons. So here are my questions:
    Is there a way on Kinematic puppets to slowly fade out the muscle and pin weights much as you do in the Death demo scene. Those are all active puppets but I'd like to obtain the same result. That way I'd be able to continue animating the puppet for a short while after they were hit with an effect so they sort of slowly fall out of their animation - think of something like falling asleep half way through a sword swing or mid run.

    Any idea why not having the animator enabled before calling Kill() would be an issue? On a kinematic puppet with a kinematic behavior puppet? Works properly in the Killing scene but not on my enemies.

    The major reason this is an issue is I play a few special kill animations if you defeat enemies in a certain way, and I call the Kill() method about half way through the animation so they ragdoll.
     
    Last edited: Sep 22, 2017
  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    hmm.. It's really difficult to fix bugs based on just descriptions, but I'll try my best... Does that flying into space happen right when you call Kill or after the kill duration? What exactly do you have in the stateSettings you pass with the Kill call? I'm trying to figure out how your puppet is different from the puppet in the Killing scene where this does not happen. Have you tried keeping all the IK disabled, does the bug occur then?
    In the code you sent me, I see that you are using coroutines for blending out of pin and muscle weights. Killing already does that on its own so there might be a conflict there.

    Anyway, you could try instead of using the Kill call, keeping the puppet alive, but using the procedure described in Dying.cs in the "Death Procedures" demo to achieve what you are looking for.

    Best,
    Pärtel
     
  35. Fairennuff

    Fairennuff

    Joined:
    Aug 19, 2016
    Posts:
    88

    So trying to use the sequence in Dying is the first thing I originally tried. But since my puppets are Kinematic it has no effect. BUT! I resolved the issue. In the PuppetMasterStates.cs script i removed the line of code that passes angular velocity when switching between states as you originally suggested. I then had to remove the same/similair line of code in the PuppetMasterModes script. Keeping directional velocity seems fine even with the animator enabled. But when applying angular velocity seemed to be the issue.

    And do answer your question, it was the moment I called the kill method. I even tried swapping them to active and fading out pin and muscle weights, then switching to the dead state manually and it appears its the moment the puppet went to dead state that it would fly off. But, as I said, removing angular velocity fixed it. Works fine in your demo scenes so it must just be something off with my puppets. They're mixamo rigged so I am guessing it has something to do with their poor rigging.
     
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Thanks for the additional info! Glad you found a workaround for it, but I'd still like to track down that bug...
    Could you try changing the public void CalculateMappedVelocity() to this?
    Code (CSharp):
    1. public void CalculateMappedVelocity() {
    2.             float writeDeltaTime = Time.time - lastWriteTime;
    3.  
    4.             if (writeDeltaTime > 0f) {
    5.                 mappedVelocity = (target.position - lastMappedPosition) / writeDeltaTime;
    6.                 mappedAngularVelocity = QuaTools.FromToRotation(lastMappedRotation, target.rotation).eulerAngles / writeDeltaTime;
    7.  
    8.                 lastWriteTime = Time.time;
    9.             }
    10.  
    11.             lastMappedPosition = target.position;
    12.             lastMappedRotation = target.rotation;
    13.         }
    Would that enable you to keep the angularVelocity untouched?
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Guys, I got conscripted for the rest of the week, will return to help you on Monday...
     
  38. Fairennuff

    Fairennuff

    Joined:
    Aug 19, 2016
    Posts:
    88
    I Did as you asked here. Uncommented line 177 from PuppetMasterStates and line 150 from PuppetMasterModes so they were active again. Then replaced the method in Muscles.cs at line 637 with the new CalculateMappedVelocity method you provided. Calling Kill() on my AI launches them into space again.

    uncommenting lines 177 and 150 respectively once again resolve the issue.
     
  39. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168
    Hey, thanks a lot for the answer, actually it was the mixamo joints that were not well oriented. So everything's fine now. I also discovered that the longer the chain is on a puppet, the more it's going to glitch. So that's why the earings for example were glitching. (I found out in the documentation how to solve it)

    I'm running into another problem, but I think this one will be easy to solve. I edited your grab script so it can work with a first person controller.

    ---Here is a screenshot of my problem :



    (The grey character is the first person model, and the yellow one is the grabbed character)

    I don't want the grabbed character to be unpinned as soon as he is taken. I want him to, in a more natural way, loose balance when the muscles are too far from target. I assumed the "knock out distance" would do that job, but it does not seem to work. Do you have any idea on how I could do that ?



    ---Something else I would like to do with puppetmaster, would be to have a global damage float, like a PV bar, that would also calculate damages from fall (a bit like in Zelda Breath of the wild)
    How could I do that ? I've seen the behaviorpuppet has script called "damage", that's why I ask, otherwise I will use playmaker for that.



    Sorry for taking your time, i'm really bad at scripting (I'm using playmaker most of the time), also, thanks in advance for the advices,
    Best,

    Jonathan
     
    Last edited: Sep 29, 2017
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    I wish I had a way to reproduce that bug, would be much easier. Anyway, if that uncommenting fix works, just use it for now, I'll keep looking...

    Hey,
    Knock out distance only works if there is a collision with anything on the "Collision Layers" of BehaviourPuppet. Are your first person character's colliders included in the collision layers?

    I wonder what's going on with that broken knee, do you have "Angular Limits" enabled in PuppetMaster?

    Best,
    Pärtel
     
  41. killerjim

    killerjim

    Joined:
    Sep 14, 2016
    Posts:
    10
    Hi Partel-Lang,

    I followed your advice on adding multiplayer puppets and in general it seems to work well, the clients follow the master (albeit at a lag, but its' not noticeable)..

    Server side I'm sending out the position / rotation of NPC's, to which the "dumb" clients are updating their copies of the NPC's. The RPC system for puppet "fall down" and "get up" works great :)

    The only issue I'm having is that when NPC's fall down, then end up in different positions (based on physics) from the server - causing a teleport.. Obviously the unpinned puppet physics on server vs client don't match (and can never.. at least without a lot of coding)..

    The NPC's puppet ignores the position being send to it during the unpin and get-up cycles, thus the resulting client side physics stick's it a different position.

    Is there a way to set the puppet to an absolute position? So the unpinned NPC can be kept in the correct location - I can lerp this over time to avoid snap backs if required.

    Thanks - great product BTW !!

    James
     
  42. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168

    Well, what I would like to do is making it work without any collision, is that possible ? It's actually working when you move forward because the fps puppet collide with the other puppet. But when you move backward, as it's not colliding with anything, it's not working. That's why I would like the Knock Out Distance to work without any collision.

    Also, that's actually the most important for me, is it possible to access with a script the muscle damages ? It would be so easy to make a health bar that way, without recalulating all the physics impulse thing.

    Thanks a lot for the help,

    Jonathan
     
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    Have you tried rigidbody syncing for while the puppet is unbalanced?

    Hey,
    Try setting behaviourPuppet.pinWeightThreshold to greater than 1. Has to be done in a script, because the Editor clamps it to 1.

    About muscle damages, you can use BehaviourPuppet's OnCollisionImpulse delegate:
    Code (CSharp):
    1. void Start() {
    2. behaviourPuppet.OnCollisionImpulse += OnCollisionImpulse;
    3. }
    4.  
    5. void OnCollisionImpulse(MuscleCollision m, float impulse) {
    6. // Apply damage here based on float impulse
    7. }
     
  44. slavaglap

    slavaglap

    Joined:
    Sep 22, 2017
    Posts:
    7
    HI Partel-Lang, !
    Perhaps with the help of your plug-in create a realistic physics of getting a strike? If you do as shown in the demo (hit in the head): muscle wight = 0.02 , muscle dumper = 0.01 then when the character runs head behaves like a toy. And if you make the musket more, then the blow is not realistic. Is it possible to reduce these parameters during the impact, and during other animations do equal muscle wight and muscle dumper to one?

    Will this work like a realistic physics of punches?
    I'm making a game for virtual reality - a boxing simulator, and I really appreciate the realism
     
  45. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    Hey,
    You could make a script that checks for the muscle.state.pinWeightMlp and lowers muscle.state.muscleWeightMlp accordingly for the head. If BehaviourPuppet registers an impact to the head, it will lower it's pinWeightMlp.
    Or you could set BehaviourPuppet's "Normal Mode" to "Unpinned" which will not show the head behaving like a toy until there is an impact.

    But fully realistic hit reactions could be achieved with using hit reaction animation and puppetmaster on top of it, especially considering that recovering from hits usually takes some footwork too, which puppetmaster can't do on it's own.

    Best,
    Pärtel
     
  46. slavaglap

    slavaglap

    Joined:
    Sep 22, 2017
    Posts:
    7
    И как вы можете проверить, что марионетка ответила на удар, чтобы вернуть его в состояние анимации?
     
  47. slavaglap

    slavaglap

    Joined:
    Sep 22, 2017
    Posts:
    7
    I am currently doing this

    void OnCollisionEnter(Collision other)
    {
    if (other.gameObject == bot)
    {
    Debug.Log("HITEM_muscle");
    puppet.SetMuscleWeights(head, 0.02f, 0f, 1f, 0.01f);
    }
    }


    What can you say about this method?
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    If muscle has collided and it's state.pinWeightMlp reduced, it will automatically recover from it. It has fully recovered when state.pinWeightMlp is back at 1.
     
  49. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,550
    It could work, but it would not recover. Check for muscle.state.pinWeightMlp as I suggested above.
     
  50. slavaglap

    slavaglap

    Joined:
    Sep 22, 2017
    Posts:
    7
    Thanks, I got it. Is it possible to smooth the restoration? I tried to change the Regain Pin speed, but it still happens