Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

PuppetMaster - Advanced Character Physics Tool [RELEASED]

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

  1. Dmeowmixer

    Dmeowmixer

    Joined:
    Jan 25, 2015
    Posts:
    12
    Oh man Partel, thank you so much. We thought we were fully updated and were so confused. Thank you thank you thank you. Everything looks good
     
    Partel-Lang likes this.
  2. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    I am finding it near impossible to align a prop when attached to the prop system (specifically a weapon). Can you provide some advice please.
     
  3. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    Never-mind, figured it out eventually, the prop example helped. Was adjusting the incorrect prop muscle, so for others having the same problem, you need to adjust the prop muscle without the puppetmaster components.
     
    Partel-Lang likes this.
  4. hermitmode

    hermitmode

    Joined:
    Sep 15, 2020
    Posts:
    46
    Hello Pärtel, what could be causing puppets failing to adapt to the ground disappearing underneath them, and getting up from lost balance in mid air? It's a problem I have reproduced many times when making either controllers or AI using PuppetMaster but have never paid enough attention to know what I am doing that is causing it. These are puppets with otherwise no logic on them, with "Puppet" and "Fall" behaviours ported from example puppets and corresponding animation controllers. They will stay in mid air upon a ground collider being removed but if forced into unpin will fall properly then get up on the lower actual ground.

    EDIT
    I've confused myself now and can't remember if this is stated functionality to begin with. I mean the fall behaviour says it does that but I cant find the raycast logic after a moderate search. I've ended up just making my own that causes an unpin when a raycast sees the puppet is too far from the ground. How does one go about calling a different behaviour? Does BehaviourPuppet.State.Falling exist or some form of equivalent? Will remove this question if I find it in the documentation
     
    Last edited: Sep 11, 2023
  5. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    Yes, BehaviourPuppet doesn't have the authority to make your character ragdoll if ground disappears from under it. You'll have to make a raycast and if ground is too far to land on your feet, call behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned); to ragdoll it. If you don't want it to get up before you allow it to get up, set behaviourPuppet.canGetUp to false.

    Best,
    Pärtel
     
  6. hermitmode

    hermitmode

    Joined:
    Sep 15, 2020
    Posts:
    46
    Thanks. What of "BehaviourFall", is that still current? Also, is there a means of specifying different animation trees for different fall instances, so I can call "unpinned" but have it animated with different fall anims?
    Also using "smooth follow" on "camera controller" is causing skipping every couple of seconds and changing the update mode does nothing (update, fixed, late, fixed late), neither does setting rigidbody to interpolate/extrapolate or changing collision detection. It's following a puppet tied to a character controller, would you have any idea how to remove this "skipping"?

     
    Last edited: Sep 18, 2023
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    Yes, BehaviourFall is still current, but all it really does is blend between different falling animations based on puppet's height from the ground, so it would, you know, appear to brace for impact before it happens. If BehaviourFall is present, then BehaviourPuppet switches to BehaviourFall when it gets ragdoll and BehaviourFall switches back to BehaviourPuppet when it starts getting up. So there is just 1 behaviour running at the same time at any time.

    About the camera thing, did you try using LateUpdate and adding your camera script to a higher value in the Script Execution Order than PuppetMaster has?

    Best,
    Pärtel
     
  8. hermitmode

    hermitmode

    Joined:
    Sep 15, 2020
    Posts:
    46
    Thank you for your continued support.
    I switched the SOE and have RootMotion.CameraController running before PuppetMaster yet it persists. I then moved it above all other Rootmotion assets such as AimIK and IKExecutionOrder but no luck. Its a controller using Puppetmaster with Aim IK, Recoil, Ragdoll Aiming etc. I will have to keep looking, thanks though
     
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    CameraController needs to run after PuppetMaster.
    Also, which target transform the camera is following? Try using the hip bone instead of the character controller.
    Those issues are easier to understand and debug if you turn time scale down to say 0.1 and fixed delta time up as much as possible, then you see it in slow motion basically.
     
  10. hermitmode

    hermitmode

    Joined:
    Sep 15, 2020
    Posts:
    46
    Thanks. The target is the spine but after changing to the hip instead it still happens. I also changed timescale to 0.1 and fixed delta to 0.1, at 0.2 the puppet would just ragdoll. Left it walking for a few minutes and it doesnt show, only shows under normal timescale.
     
  11. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    76
    Hey I had this problem again. Adding UpdateAnchor(true) to the Muscle script fixed it. I dont remember was that line added at some point and taken out again? Is there some other solution to fix this issue? Thanks!

    EDIT: Also Biped Ragdoll Creator incorrectly assigns references for Character Creator 4 character, it gives this warning:
    "BipedReferences limb hierarchy is invalid. Bone transforms in a limb do not belong to the same ancestry. Please make sure the bones are parented to each other"

    The bones are correct though and I have to manually change the references. (The CC4 characters have some extra bones) Is there way to make eg. preset/config?
     
    Last edited: Oct 20, 2023
  12. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    Sure you have the latest PuppetMaster, that bug was fixed in the latest. Can see version info in Plugins/RootMotion/PuppetMaster/PuppetMaster ReadMe file. Latest is 1.2.

    BipedRagdollCreator gets its references via animator.GetBoneTransform(), so it's the arm and leg bones from the Humanoid rig. Maybe you can change those bones in the avatar configuration scene?
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Which character controller is that you were using, self made or 3rd party like Opsive?
     
  14. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    76
    Wow, sorry, I remember checking earlier from the Package Manager that I couldn't update PuppetMaster, but now I checked and I could and I had the 1.1 for some reason...

    BipedRagdollCreator works also now, I didn't have Animator in the character as I use custom animation. But now on I'm gonna add it with the correct avatar for a moment to get the correct references
     
  15. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    118
    Hi Partel,

    I'm having an issue that when my character starts the game, the prop starts in the correct position, and after 1 second it slides to a wrong position.
    bfvsdfsfsdf.PNG
    fbdfvsds.PNG



    I tried putting the Prop Muscle Target in the correct position as shown in the image below, and then going to PuppetMaster and fixing the positions and rotations, and the issue still persists.
    cascad.PNG

    Any solutions?

    Many thanks!
    Gabriel.
     
  16. hermitmode

    hermitmode

    Joined:
    Sep 15, 2020
    Posts:
    46
    It's a self made controller setup that uses a Character Collider/Controller component (cant remember off the top of my head). It has utilised parts of your "third person controller" mixed with the recoil example and uses "puppet aimer" as well.

    Another issue presents itself also, is there a way beyond PinPow being raised to allow a puppet to walk steep inclines without unpinning? It may be that I am just testing in an unoptimised area with too many mesh colliders at once that it becomes unstable but I am having a lot of ragdolling upon waling up sharp inclines
     
    Last edited: Oct 30, 2023
  17. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    76
    I want puppet's muscle collisions to affect things on my scripts, so not necessarily just the Puppetmaster's variables (pinweights etc), are PuppetBehaviours still the way to go? I saw there was MuscleCollisionBroadcaster that is tied to having PuppetBehaviours?
     
    Last edited: Nov 1, 2023
  18. Cybertiger

    Cybertiger

    Joined:
    Dec 19, 2013
    Posts:
    36
    Hi Partel,

    I was using PuppetMaster a few years back on single player games and it worked fine. My current project requires Multiplayer and we are using Photon Fusion for that. My ragdoll character prefab works fine in an empty scene without fusion but once i spawn the same prefab through fusion PuppetMaster get's disabled. It seems that
    Code (CSharp):
    1. Physics.autoSimulation
    always returns false.
    Is there any recommended way how to use fusion with PuppetMaster or is this not supported at all?
    Many thanks in advance.
     
  19. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    A few questions:
    Are you setting PuppetMaster mode to disabled when you start the game?
    If so, does changing Blend Time in PuppetMaster change when the prop target moves out of place?
    If you disable animation, does it still move out of place?

    Hey,
    Ideally you should remove walkable surfaces from BehaviourPuppet's "Collision Layers" so ground collisions would not unpin the puppet at all. Could also increase "Knock Out Distance" for the foot/leg muscles in BehaviourPuppet's "Group Overrides", there's also an option to "Disable Colliders" for the foot group while the puppet is pinned so the feet would not get friction from the ground.

    Hey,
    Could add a listener to BehaviourPuppet.OnCollision(MuscleCollision m) delegate, that gets called by the MuscleCollisionBroadcasters and contains the Collision data.

    Hey,
    I've only made some very basic tests with Fusion, this is how I got a puppet to run on it:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using RootMotion.Dynamics;
    5. using Fusion;
    6.  
    7. public class NetworkPuppet : NetworkBehaviour, IBeforePhysicsStep, IAfterPhysicsStep
    8. {
    9.     public PuppetMaster puppetMaster;
    10.     private Vector3 lastTargetPos;
    11.     private Quaternion lastTargetRot = Quaternion.identity;
    12.  
    13.     void Start()
    14.     {
    15.         puppetMaster.enabled = false;
    16.         puppetMaster.transform.parent = null;
    17.  
    18.         lastTargetPos = puppetMaster.targetRoot.position;
    19.         lastTargetRot = puppetMaster.targetRoot.rotation;
    20.     }
    21.  
    22.     public void BeforePhysicsStep()
    23.     {
    24.         if (!Runner.IsForward)
    25.         {
    26.             puppetMaster.targetRoot.position = lastTargetPos;
    27.             puppetMaster.targetRoot.rotation = lastTargetRot;
    28.         } else
    29.         {
    30.             lastTargetPos = puppetMaster.targetRoot.position;
    31.             lastTargetRot = puppetMaster.targetRoot.rotation;
    32.         }
    33.        
    34.         puppetMaster.OnPreSimulate(Runner.DeltaTime, Runner.IsForward);
    35.     }
    36.  
    37.     public void AfterPhysicsStep()
    38.     {
    39.         puppetMaster.OnPostSimulate();
    40.     }
    41.  
    42. Best,
    43. Pärtel
    44.  
    45. }
     
  20. imaewyn

    imaewyn

    Joined:
    Apr 23, 2016
    Posts:
    211
    Hi Partel-Lang, I have question about AddForce to Puppet. When I try do this like
    this.Ragdolls.ForEach(e => e.AddForceAtPosition(val, ransform.position, ForceMode.Impulse));
    I have bug with rubber hand stretching, It gets very long.
    upload_2023-11-3_17-20-30.png
    It lasts literally a second, then the state of the hands normalizes and physics continues. But this does not always happen and only with great strength. Is it possible to somehow avoid this problem?
     
  21. Cybertiger

    Cybertiger

    Joined:
    Dec 19, 2013
    Posts:
    36
    Thanks. I got that working but my Puppet always spawns dead on the ground. The puppet itself (RB colliders) is standing but the skinned mesh is on the ground. It almost looks like there is a second instance running for the puppet but there isn't. At least not any obvious one.

    In your example you also have:
    Code (CSharp):
    1. puppetMaster.OnPreSimulate(Runner.DeltaTime, Runner.IsForward);
    But there is now method override for "OnPreSimulate" that accepts a bool. Only the float is accepted. What do you use the bool for in your "OnPreSimulate" method?
     
    Last edited: Nov 3, 2023
  22. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    118
    Thanks for the reply Partel!

    The PM wasn't disabled, I actually fixed it by disabling AngularPinning and activating UpdateJointAnchors and
    SupportTranslationAnimation

    Gabriel.
     
  23. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    76
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    You'll have to ragdoll the puppet before you add forces to it, otherwise the forces that are trying to pin the puppet to its animation will cancel out whatever forces you add to the ragdoll and you only see some weird stuff when the forces get insanely big. Call BehaviourPuppet.SetState(BehaviourPuppet.State.Unpinned); Can also unpin partially using puppetMaster.SetMuscleWeightsRecursive() if you don't want to ragdoll the entire puppet.

    Oh, damn, so sorry I forgot I made changes that haven't been published yet...
    Please go to PuppetMaster.cs and add in those 2 changes to the code>

    upload_2023-11-13_15-6-6.png

    Hey,
    I think your PM might be out of date (I just updated the package today, but even the previous one had the custom editor for configurablejoints disabled because Unity added pretty much the same kind of joint editing tools to 2022 as PuppetMaster had for a long time). If you go to ConfigurableJointInspector.cs, you should see this bit that disables the custom editor for 2022 and later:

    upload_2023-11-13_15-19-51.png

    Best,
    Pärtel
     
    imaewyn likes this.
  25. Gray_FoxWare

    Gray_FoxWare

    Joined:
    Jan 31, 2019
    Posts:
    16
    Hello Pärtel Is it possible to use puppetmaster for scorpions, spiders or snakes?
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Technically, yes, I've used it on many different creatures. The ragdoll setup process needs to be done by hand though as BipedRagdollCreator can do only bipeds. PM requires ConfigurableJoints, but if you find them confusing, can build the ragdoll with CharacterJoints, then select the root of the ragdoll and do GameObject/Convert to ConfigurableJoints when you're done.

    Best,
    Pärtel
     
    Gray_FoxWare likes this.
  27. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,556
    Hi @Partel-Lang - PuppetMaster has interested me for ages now, amazing job on this.. it's on my "will buy soon-ish" list for sure because i finally have something on the go it'd be perfect for - also, seeing you active here supporting it and seeing how recently the latest update was is reassuring :)

    I have a question (well, some questions) whether something is possible or not, which won't actually influence my decision to purchase but helps me visualize what it's capable of doing out of the box, and planning/refining my approach to things within limitations.

    Let's say I have the left hand grab something (by IK), and the right hand grab something, can I ragdoll the rest of the body so it would dangle appropriately pinned, as if the body was hanging by the hands? So while it's hanging there, I could move one of the things an IK target of a hand is parented to and the hand would remain "attached" to it and the body's joints would adjust accordingly? And if so, given the blending between ragdoll and animations capabilities, I'd be able to for example run an animation of the legs kicking a bit or whatever? Is it possible to procedurally "pin" multiple arbitrary points (or joints), like as if a puppet got snagged at several positions, and if it had a running animation active, with one leg got stuck (as in, i've called a function that a point on the leg was to remain "pinned"), the other leg would still be trying to run until I stop the animation or make it fully ragdolled/dead? Or.. does it have to be fully ragdoll before animations can be overridden by "pinning"? Does the entire puppet need to transition between ragoll<->animation or can specific parts of the body be pinned while the rest still tries to animate? Sorry if it's a complex question - thanks for whatever clarifications you can provide!

    Edit: I picked this up along with Final IK today and my questions were answered by your demo scenes ;)
     
    Last edited: Nov 16, 2023
    Partel-Lang likes this.
  28. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    76
    Hello @Partel-Lang,

    What is the correct way to make the puppet hold current physics pose? (Will sampling the current rotations of the physic joints and then setting those as the target rotations lead to problems?)

    Example to illustrate what I'm looking for:

    1) Right arm collides with cube and can't reach target blue pose inside cube

    2) After press of some button, the right arm's target pose would be set to its current physics pose, so it just keeps the hand there even if the cube is removed


    (PS. Couldn't find any info on muscle.targetMappedPosition/Rotation and targetSampledPosition/Rotation in the docs, are they just eg. temporary variables for PuppetBehaviour transitions? What is PuppetMasterLite? A lightweight version for performance? Is there some specific usecase for it?)

    Thank you
     
  29. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    @Partel-Lang After an hour of debugging I think it would be good to add a dedicated page to the documentation about physics layers and what a layer setup should look like.

    Since the current package doesn't include project settings, I created a puppet without first setting up a ragdoll layer, project physics lay settings, etc. While the demo scenes still work even if the project is missing the ragdoll layer setup (remembers the layer integer), new puppets may not.

    While replacing the model in the NavMeshAgent scene the ragdoll layer wasn't assigned in the BehaviourPuppet's collision layers. Maybe since I created the puppet before setting up the layers? It could be there needs to be a check to see if the assigned layer exists in the project settings when setting up a BehaviourPuppet.

    Adequate information about layers is spread out across two doc pages and a video. Physics layer bugs aren't fun to track down, maybe add a notice to set up layers before creating new puppets. Maybe include a package that imports project settings that match the demo layer setup.
     
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    Store the localPosition of the pelvis and localRotation of pelvis and all its children after PM has finished writing (use the PuppetMaster.OnWrite delegate). Then force those localRotations on the bones in PuppetMaster.OnRead.

    targetMappedPosition/Rotation and targetSampledPosition/Rotation is used by BehaviourPuppet to smoothly blend from ragdoll pose to the getting up animation when the puppet starts getting up.

    PuppetMasterLite is a lightweight version of PM, it basically just does the core active ragdoll stuff without any bells and whistles. It was designed for people who want 100% understanding and control over their project and prefer to write their own version of something like BehaviourPuppet or just don't need anything like that. To convert to PML, add the PuppetMasterLite component on the PuppetMaster gameobject and click on the convert button.

    Hey, thanks for the feedback!
    PM demos are set up to work with Unity's default layer settings, so importing PM to an empty new project always works. About the layers, here's what you should keep in mind:

    1. Character controller and ragdoll layers must not collide
    2. Any raycasting to find the ground or for foot placement correction must not hit the ragdoll or the character controller layers
    3. If you have objects you want the puppet to smash into, put them on the layer that is ignored by the character controller layer, not ignored by the ragdoll layer and add that layer to BehaviourPuppet's "Collision Layers".
    4. If you don't want the puppet to smash into walls, make the wall layer collide with the character controller
    5. Walkable surfaces should be added to BehaviourPuppet's "Ground Layers"

    Cheers,
    Pärtel
     
    WonkyDonky likes this.
  31. simonkingandaoking

    simonkingandaoking

    Joined:
    Dec 27, 2021
    Posts:
    21
    can i ask how to make two handed weapons correctly?for example if its on the right hand,how to lock the left hand to it,do i need other methods like final ik?
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    Constraining the other hand to the weapon physically would not be a good idea. There will probably be many places in the animation where you need to let go and grab again and it would be an absolute nightmare to manage. So the best option would be to use IK on top of PuppetMaster, to put the left hand back to where it was relative to the weapon before all the PuppetMaster stuff.

    PuppetMaster.OnRead delegate gets invoked before PM starts reading the animated pose.
    PuppetMaster.OnWrite delegate gets invoked after PM has finished for the frame.

    So in OnRead you should store the position and rotation of the left hand relative to the weapon:
    leftHandRelPos = weapon.InverseTransformPoint(leftHand.position);
    leftHandRelRot = Quaternion.Inverse(weapon.rotation) * leftHand.rotation;

    Then in OnWrite, do the inverse of that to put the left hand back to where it was relative to the weapon:
    ik.solver.IKPosition = weapon.TransformPoint(leftHandRelPos);
    ik.solver.IKRotation = weapon.rotation * leftHandRelRot;
    ik.solver.Update(); // disable the IK component in Start to manually update it

    Last bit of code uses Final IK, but if you don't have it, any simple 3 point IK solution that you can update manually at any time will do.

    Best,
    Pärtel
     
  33. BeefyDonkey

    BeefyDonkey

    Joined:
    Oct 28, 2018
    Posts:
    1
    Hi @Partel-Lang

    I recently bought your asset and I love it!

    I have a straightforward question: How can I create a smooth transition from a ragdoll state to an animated character in my game? Specifically, when I shoot an enemy in the leg, I want them to enter a ragdoll state. While in this state, I switch their animator to one with override animations for crawling (Idle, Movement and Attack). Then using BehaviourPuppet I try to get the character back up and resume being animated.

    My challenge is to transition seamlessly from the ragdoll state back to the animated character.
    upload_2023-12-10_21-42-51.png


    I utilize BehaviourPuppet to assist the character in standing up and returning to a fully animated state but for some reason the character starts glitching all over the place.

    Here is how my BehaviourPuppet is configured.
    upload_2023-12-10_21-48-16.png

    I will greatly appreciate your help on this!
    Have a nice day!
     

    Attached Files:

  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    You should not call SetState with GetUp and Puppet, BehaviourPuppet already does that automatically. The parameters here: upload_2023-12-14_15-23-5.png

    define when the ragdoll is settled and able to get up. You can add a listener to the onLoseBalance and onGetUpProne/Supine events to change the animator stuff.

    Best,
    Pärtel
     
  35. ezcoxe

    ezcoxe

    Joined:
    Mar 11, 2020
    Posts:
    1
    Hi @Partel-Lang ,

    I am wondering if it is possible/what would be the best way to have a hybrid of puppetmaster and a simple ragdoll controlled by configurable joints. I would like to be able to manually set the targetRotation of the configurableJoints for anything from the spine and above in the body but leave the pelvis and legs as part of puppetmaster. Is this possible? When the entire body is controlled by puppetmaster setting targetRotation has no effect on the spine configurable joint for example, but if I remove the joints I'd like to control from the muscles in puppetmaster they no longer have any effect on the mesh.

    I suspect the answer to both of my questions may be elsewhere in the forums but I have searched for a few hours with no success.

    Thanks in advance for any help. I have been thoroughly enjoying both FIK and PM.

    Edit: I found a way to do this by using puppetmasterlite and just adding a bool condition to musclelite called customControl. Then in musclelite Update(), if (customControl) { CustomControl(); } else {Pin(); MuscleRotation();}
     
    Last edited: Dec 17, 2023
    Partel-Lang likes this.
  36. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey @Partel-Lang,

    We are adjusting the Fixed Time Step on start-up to match the refresh rate of the VR headset the user is wearing. How would you recommend changing the puppets so they behave similarly for different fixed delta times? (i.e. change the joint springs & dampers & max force? Change something on the Puppetmaster itself?

    Cheers,
    Colton
     
  37. simonkingandaoking

    simonkingandaoking

    Joined:
    Dec 27, 2021
    Posts:
    21
    hi,can i ask how to make a editor script to change a puppets model,i see a replace character model in CharacterPuppetInspector,but its for characterpuppet,or maybe you can point a path to how can i let players mode my game and swap out character models?;)
     
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    There's no way to get identical results with different fixed delta times, but what you should do is reduce Muscle Spring when you reduce fixed delta time because more frequent physics updates make the muscles stiffer and stronger. I usually keep Muscle Damper at 10% of Muscle Spring, so also reduce that.

    Hey,
    It's usually easier and safer to build, not replace. So I would recommend you to look into the "Creating Ragdolls in Runtime" and "Creating Puppets in Runtime" demos instead.

    Best,
    Pärtel
     
  39. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    76
    What is the correct way to move muscle instantly to position and rotation without any twitches or glitches?

    muscle.MoveToTarget()? but should one also call eg. muscle.ClearVelocities()?

    Or are there some additional functions one should call?

    (+ Do all of those 100% need to be called from eg. OnWrite or FixedUpdate etc?)

    Thank you
     
    Last edited: Jan 21, 2024
  40. Larsson24

    Larsson24

    Joined:
    Nov 2, 2020
    Posts:
    7
    Hi @Partel-Lang! Is it difficult to integrate PuppetMaster with Photon Pun2 or Photon Fusion? I have seen that you had an unity packed for pun2 somewhere in this forum but don't know how up-to-date it is and if it still works. I also saw your Fusion script comment above on this page. Is it that simple to get it working? Will you make a Fusion pack as well?

    Any recommendation on which one to use to keep it as simple as possible. I ready that Fusion have better physics than pun2.

    I'm doing a horror multiplayer party game where the murderer can knock down and kill the players. How much harder is it to use active ragdoll in multiplayer game then a regular character controller? Many thanks for your help! :)
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    Yes, MoveToTarget and ClearVelocities from FixedUpdate should do it. But you're looking to teleport the puppet to another location, you should use puppetMaster.Teleport(). That you can call at any time because PM will wait until the right moment in the frame to actually execute the command (so it might happen a frame later if you call it too late).

    Hey,
    There's a PUN2 basic example included under Plugins/RootMotion/PuppetMaster/_Integration folder. It should be up to date. I just recently released a game with PUN2 puppets (Dungeons of Eternity). Fusion is a lot more difficult to integrate with PM, I haven't played around with that a lot.

    Best,
    Pärtel
     
  42. Larsson24

    Larsson24

    Joined:
    Nov 2, 2020
    Posts:
    7
    Wow, Dungeons of Eternity is very impressive! Congratulation on your release! :)
    Im currently using Opsive UCC with pun2, and I have seen that there is a PM integration for UCC as well. Now, the difficult decision is if I should add PM or ignore it as scope creep. UCC is already quite complex and hard to work with as is. However, having players be able to fall while being chased or make other players tripp to save themself would be hilarious.
    Thanks for your help!
     
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Thanks!
    There's a problem with UCC3, I haven't found a way to get rid of it jittering together with PuppetMaster in Normal animator update mode, so best to avoid adding PM to it for now.

    Cheers,
    Pärtel
     
  44. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Is there any parameter to disable puppet master at a far distance to improve the game’s performance?

    When I switch active mode to kinematic or disabled, my character can’t draw the gun correctly! So I need to keep Puppet Master active all the time, but it would be nice if there was a parameter to ignore far enemies.
     
    Last edited: Feb 8, 2024
    Adgeinator likes this.
  45. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    What do you mean with it can't draw the gun correctly? Switching to disabled mode is the intended way of doing this, so it would be best to just fix whatever is causing the gun drawing issue.

    Best,
    Pärtel
     
  46. simonkingandaoking

    simonkingandaoking

    Joined:
    Dec 27, 2021
    Posts:
    21
    do you know why is it that some times when game starts,the puppet falls through the ground and cant snap back,i believe it has to do with the puppet colider falling through the ground at start of the game,this only happens one time out of 100,but it breaks the game cause there isnt any coliders anymore,might have something to do with my code but i was wondering if you heard other people talking about it:)love Dungeons of Eternity ,such smooth combat!wonder if you can maybe share some puppet settings like the spring and damper stuff;)
     
  47. Liam2349

    Liam2349

    Joined:
    Mar 10, 2016
    Posts:
    88
    Hi, I am having an issue with Animancer. The puppet gets stuck under these conditions:
    • Puppet mode Active.
    • Animator update mode Normal.
    • Animancer plays an animation, AnimatorController removed from Animator.
    • Animancer's "LowUpdateRate" component is enabled. This updates the animation at the specified FPS.
    The puppet gets stuck in some sort of t-pose, jittering around slightly. This occurs after enabling the LowUpdateRate component. I tested this in the Puppet Raycast Hit scene.

    If I change the puppet mode to Kinematic or Disabled, the puppet is no longer stuck and animates normally.

    I would like to control the update rate of the animation, even when the puppet is Active. I have found that when I apply forces to the puppet at very high frame rates (>300 FPS), the effective force is much larger than expected. When I apply the fix for Animancer + Animate Physics (https://forum.unity.com/threads/pup...ics-tool-released.358445/page-49#post-9019648), this limits the update rate of the puppet and can solve the problem, but I would like more control of the update rate than only being able to set it to the physics rate.

    Do you know any solution to this?
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,567
    Hey,
    Are there any errors or warnings from PM in the Console when that happens? And is your PuppetMaster version up to date? It used to be a problem with the older versions.

    Hey,

    Both PuppetMaster and Final IK would have a 1000 lines less code if Unity provided a way for us to know when Animators are updated. It is crucial for PM because it needs to do certain things before animation, after animation, before physics and after physics.

    I don't know what that LowUpdateRate script does, I guess it calls Animator.Update() at a lower rate. Maybe if you opened up PuppetMaster.cs, renamed protected virtual void LateUpdate() to something else and made it public and made LowUpdateRate call that function after it updates the Animator. It has to be called after the physics update step though so probably call it from LateUpdate, but only if Animator.Update() has been called earlier in that frame.

    Btw, it is also possible to make PM work with manual physics updates. For that you'll have to disable the PM component from Start and do this:

    Code (CSharp):
    1. foreach (PuppetMaster puppetMaster in puppetMasters)
    2. {
    3.      puppetMaster.OnPreSimulate(deltaTime);
    4. }
    5.  
    6. Physics.Simulate(deltaTime);
    7.  
    8. foreach (PuppetMaster puppetMaster in puppetMasters)
    9. {
    10.      puppetMaster.OnPostSimulate();
    11. }
    Note that puppetMaster.OnPreSimulate(deltaTime) also updates the Animator.

    Best,
    Pärtel
     
  49. Liam2349

    Liam2349

    Joined:
    Mar 10, 2016
    Posts:
    88
    Hi, thanks for your response.

    I tried the LateUpdate suggestion and it has helped - in the Puppet Raycast Scene, the puppet is boxing, and if I manually call LateUpdate() only on the animator update frames, and I untick "Fix Target Transforms", the boxing animation plays at a custom rate and the skinned mesh follows the colliders.

    There is an issue though if the animation contains movement (or root motion?), where the movement seems to be multiplied. Do you know why this could be?
     
  50. InfinityGameDev

    InfinityGameDev

    Joined:
    Jun 28, 2016
    Posts:
    54
    Hi all, has anyone used this with Netcode For GameObjects? Not sure if anyone has any good solutions for the ragdoll syncing.