Search Unity

PuppetMaster - Advanced Character Physics Tool [RELEASED]

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

  1. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Thank you so much! so simple and still couldnt think of it! It works perfect
     
  2. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    Hey Partel,

    Do you have any tips for adjusting individual muscle settings?

    I’d like to have my puppets display injuries, so if their arm is broken I want it to losely dangle.

    To do this I’ve been dropping pin and muscle weight on injured parts depending on severity of injury, but it only seems to impact things when set close to 0, and most of the time the part seems to follow the animation anyway depending on the part.
     
  3. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Hey partel
    I read somewhere that puppetmaster and ice cc work well together...are there any videos or posts on how to set them up together?
     
  4. Partel-Lang

    Partel-Lang

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

    You should use PuppetMaster.SetMuscleWeightsRecursive().
    Code (CSharp):
    1. public void SetMuscleWeightsRecursive(HumanBodyBones humanBodyBone, float muscleWeight, float pinWeight = 1f, float mappingWeight = 1f, float muscleDamper = 1f) {
    For example if you wish to injure the right arm, you should call that with HumanBodyBones.RightUpperArm.
    If the "injury" is not enough, just lower the weights, the pinWeight should probably be 0. If you increase muscleDamper value, the arm will become more lazy.

    Hey,
    Sorry, I have no idea about "ice cc", never heard of it actually.

    Best,
    Pärtel
     
  5. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    375
    Is there an example of PuppetMaster + FinalIK with the supplied `CharacterPuppet` controller? I know there is a small set of demoes in the integration folder, but none involve a player controller.

    I've managed to set it all up, but it appears to me there is a problem in ordering of the IK / Physics, as I am getting teleporting animation transitions, like so:


    It seems like the character controller isn't moving as far as the ragdoll. So when it blends back, to snaps to the position of the controller.
     
    Last edited: Nov 10, 2019
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    What kind of IK were you using/need to use on that CharacterPuppet controller? Normally it should just work as expected if you add on the IK. About your screen capture, that kind of a bug usually happens when a character controller does not adapt to the new position of the puppet provided by BehaviourPuppet when it starts to get up. The character controller must be disabled while the puppet is unpinned and when it gets up from wherever it landed, the character controller must accept the new position of the character and go on from there.

    Best,
    Pärtel
     
    strich likes this.
  7. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    375
    Cheers Partel, I fixed it -> Puppet Master had the wrong Target Root transform.

    I've got Full Body IK and Interaction System components on this character as well, so I can physically push buttons, etc. That's fine right?
     
  8. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Is it possible to keep the puppetmaster hierarchy separate from the character or does it have to be parented with the character?
     
    Last edited: Nov 26, 2019
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Yes, it should be fine. I haven't even tried that actually myself, but can't think of a problem.

    Hey,
    It is possible. You can decouple them after you have set up the puppet. Networked rigs usually require network components to be on the root of the character and if you have Rigidbody syncing on that, it will be a problem for PM, because the ragdoll needs to be actuated by physical forces only. To solve that, you can rearrange the prefab like this:
    Network Dummy.JPG

    Then call puppetMaster.transform.root = null; after the prefab has been instantiated to make sure PuppetMaster transform is not messed with.

    Cheers,
    Pärtel
     
  10. pravusjif

    pravusjif

    Joined:
    Jul 24, 2012
    Posts:
    18
    Hi Partel



    How can I make the behaviour be initiated by the PuppetMaster? recently I updated the plugin in my project and suddenly this reference is always null.
     
  11. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    Hi Partel thanks for all the help so far.

    I noticed when my puppet swings a weapon during melee attacks, the collider sort of slides off and is out of sync with the mesh/object during the swing. I see this happening in both my own game and the Melee demo, and with both Unmapped and Active puppets. Is there a way to fix this? (the screenshot below is an Active puppet)

    upload_2019-11-20_17-56-30.png

    Thank you
     
  12. Tmtakala

    Tmtakala

    Joined:
    Mar 12, 2014
    Posts:
    16
    Has anyone tried the new Havok physics with PuppetMaster? Does it make a difference in terms of simulation stability and accuracy?
    https://blogs.unity3d.com/2019/11/06/havok-physics-in-unity/

    Apparently krehzzzy on this same thread (page 32) had gotten more stable results with the new joint solver in Unity 2019.3, but Partel didn't notice much difference and recommended using the old solver (because it is faster) unless there are stability issues. I found this interesting.
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    By always did you mean you tried to check it in Update too? If not, I think it's just that you are using behaviour.puppetMaster in Awake before PM has initiated so please try switching to Start.

    Hey,
    I don't see that happening here, so I'm guessing maybe you have changed fixed delta time in that project to a larger value so PhysX has trouble solving those joints accurately enough.

    Hey,
    Havok is on my roadmap, but it's likely gonna take a major rewrite to make it work, rather than just a quick try.
    Hopefully Havok will be more similar to Unity Physics and it's not gonna be 2 major rewrites :)

    Cheers,
    Pärtel
     
  14. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    Thanks for the response, unfortunately it looks like my fixed delta time is still set to the default of 0.02

    upload_2019-11-25_19-46-59.png

    Do you have any other ideas as to what might be causing this? I'm having trouble finding similar issues/answers on google.

    Thanks again.
     
  15. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117
    Hi Partel.

    I was looking at this post, but I quite couldn't understand it. Could you please give me an example on how to, let's say, disable the body and upper chest of a puppet?

    Many thanks,
    Gabriel.
     
  16. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Could you please create a new project and see if it looks the same there? Would help isolating the problem.

    Hey,
    So if you try adding this script to the puppet in the "Puppet" demo:

    Code (CSharp):
    1. using UnityEngine;
    2. using RootMotion.Dynamics;
    3.  
    4. public class SetMuscleWeightTest : MonoBehaviour {
    5.  
    6.     public PuppetMaster puppetMaster;
    7.    
    8.     void Update () {
    9.         if (Input.GetKeyDown(KeyCode.A))
    10.         {
    11.             puppetMaster.SetMuscleWeightsRecursive(HumanBodyBones.LeftUpperArm, 0.01f, 0f);
    12.         }
    13.     }
    14. }
    That would make the whole left arm just dangle after you press A. That is because we're setting muscle weight to a very low value to make the arm muscles very weak, also setting pin weight to 0 to disable the world space AddForce pinning to animation for the arm.
    If you use HumanBodyBones.Spine, it would have the same effect on the whole upper body.

    Best,
    Pärtel
     
  17. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    OK made a new project and just imported puppetmaster...good call, the collider slides off maybe a little bit but not nearly to the extent as it does in my project.

    From the fresh project:
    upload_2019-11-29_18-3-46.png

    I wish I knew more about how it all worked so that i can offer up some clues, but I'm at a loss here so any help is much appreciated!
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    OK, could be a number of things, probably something in the Physics Settings like a lower "Default Solver Iterations". Maybe make a screenshot of the default PhysicsManager and then compare it to your project.
     
  19. joebain

    joebain

    Joined:
    Oct 24, 2014
    Posts:
    49
    Hi, I'm trying to create an explosion effect, so my puppet will be sent up in the air with some force, while playing a flailing animation, which fades into a ragdoll. I'm slightly tearing my hair out though because the character is stuck in place, they respond to the force, but don't go flying. I have tried setting the muscle pin weights to 0 which from what I've read ought to allow the physics to take over and send my character into the air, but it seems to have no effect.

    PuppetMaster.SetMuscleWeightsRecursive(0, 1, 0);


    If I increase the explosion force they will go flying but they go way too far, it seems like in this case PM is allowing the puppet to "break" free and gives up control or something? The docs are not that helpful when it comes to understanding some of the core concepts unfortunately.

    Thanks!

    Edit: It seems that if I don't call
    PuppetMaster.Kill()
    then the ragdoll behaves as I want. I wonder why this is causing a problem?
     
    Last edited: Dec 2, 2019
  20. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    Hey,

    Turns out the Physics Settings are identical except for the layer matrix. I set the Default Solver Iterations to the max (255) and the problem still remains.

    Another clue, it seems to get worse on collision with another ragdoll object, see the screenshot below:

    upload_2019-12-2_20-12-26.png

    Contrast this with the following screenshot from my test project, solver iterations set to 6:

    upload_2019-12-2_20-14-43.png

    As you can see there's still some sliding but this is more of an acceptable level in my opinion.

    Other than the solver iterations, is there anything else I should take a look at?

    Thanks
     
  21. cfusion

    cfusion

    Joined:
    Jul 18, 2011
    Posts:
    12
    Were you able to fix the issue with the Ragdoll Editor? I'm having the same issue using Unity 2019.2.10.
     
  22. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, Partel, the lastest Puppet Master "Disconnecting Muscles" example has some bugs.
    The skeleton falls down immediately after starting. This is verified in 2019.2.14f1
    Thanks.
    upload_2019-12-3_14-35-28.png
     
  23. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117
    I did! But I don't remember what I did to fix it. I think I started the puppetmaster setup from the very beggining.

    EDIT: I think I remember how I did it. It could be possible that the bones on your Full Body Biped IK might be without references
     
    Last edited: Dec 3, 2019
  24. SSSekhon

    SSSekhon

    Joined:
    Jun 3, 2016
    Posts:
    11
    Amazing product Partel, probably one of the best assets (along with Final IK) available.

    A few question if I may please.

    So I'm developing a fighting engine/boxing game that has the mechanics pretty are far along. Currently I cause knockdown when either health drops to 0% or an attack causes a knock down based on an algorithm that factors in attack power, fatigue, durability etc and then fell switch the puppet master to the correct state. In this way I can use the behaviourPuppet and follow how you have outlined things.

    However what I would prefer to do is go to ragdoll for falling down so we get alot more randomness but then switch to behaviourPuppet for getting back up.

    How would one go about this in the correct manner as I get many bugs and adverse effects with my current tests.

    Thank you.
     
  25. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    Hey are you using the fall and get up States from PuppetBehavior? Check out Third Person Puppet gameobject on the Melee demo.

    I’m also working on a melee combat system. Basically I have a script in each puppet master collider that checks for a “critical” hit, and if one occurs I drop the pin weight/muscle strength and set “can get up” to false in the PuppetBehavior script. I then play a animation depending on the type of damage received while the puppet is downed. After a certain amount of time I restore the pin weight and muscle and cangetup back to true, and PuppetBehavior will automatically do its thing and play whatever GetUp animation you put in the state.

    Sorry I’m on mobile and definitely have some of the variable and script names wrong, but check out melee demo that should cover it. You need the PuppetBehavior script and the corrosponding mechanim states.
     
    Partel-Lang likes this.
  26. SSSekhon

    SSSekhon

    Joined:
    Jun 3, 2016
    Posts:
    11
    Hey, thanks for your help.

    Yes that is how I currently do it but would like to go to more of a ragdoll approach and then blend to an animated get up.

    I also set the can get up variable to false and start a timer (0-10 for boxing knockdown) and randomly set can get up to true if my puppet can get up.

    I'm also typing of mobile so want to keep this reply brief but will hopefully go more in depth to explain what I'm doing and want to achieve.
     
  27. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117

    Hey man,

    So what I did was, I created Unity Event and invoked it when the character dropped below 0% health, and the Event was "Kill" from puppet master, like the example below(did the image upload correctly?):


    If you want the character to get up afterwards, you just gotta use another Event called "Resurrect"(For the getting up animation, you gotta use the "Puppet (with Fall) and Fall" animations like the example from this video:
    )

    Let me know if you have any questions.
    Gabriel.
     

    Attached Files:

    Partel-Lang likes this.
  28. SSSekhon

    SSSekhon

    Joined:
    Jun 3, 2016
    Posts:
    11
    Brilliant, thank you. I will try this when I'm next playing around with it.
     
    gliealonso likes this.
  29. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Just make sure to call
    Code (CSharp):
    1. behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned);
    before you add explosion force to the ragdoll. Otherwise the pinning forces that keep the puppet pinned to the animation will neutralize your explosion forces (unless they are big enough to make the ragdoll parts exceed BehaviourPuppet's knockOutDistance).

    That's very odd, have not seen it before. Which Unity version are you using? Maybe something related to that. Maybe you could zip that project (even if it's just PM) and send a link over via PM?

    Hey,
    Which Unity version were you using and which PuppetMaster version (can check that from Plugins/RootMotion/PuppetMaster/PuppetMaster ReadMe)?

    Hey,
    Just loaded up v0.9 in 2019.2.14f1, but did not see it. Did you try in a new empty project? Perhaps your project has Layer Collision Matrix changed from the default, that usually is the cause of demo scenes failing.

    Hey and thanks!

    Basically, if you used the "Puppet" prefab from the package, just drop it under "Behaviours" gameobject in the puppet hierarchy. Then select the "Humanoid Third Person Puppet" animator controller and copy the "BehaviourPuppet" and "BehaviourFall" sub-state machines over to the animator controller that you are using. Make a transition from the "BehaviourPuppet" sub-state machine to you idle animation state, just like in the "Humanoid Third Person Puppet" controller. That should get the losing balance and getting up system going.

    If you have melee attacks, it's good to use Boosters to give the attacks more punch. Declare a public Booster booster; in your AI script and fill it out in the editor. When an attack starts, call booster.Boost(behaviourPuppet) to give the attacking puppet some temporary immunity and/or impulse multiplication. The boost effect falls off over time, defined by "Boost Falloff" in BehaviourPuppet. Value of 1 means the effect will be gone in 1 second.

    Tweak the "Collision Resistance" and "Knock Out Distance" values in BehaviourPuppet to define how much impact damages the pinning and how far the muscles can drift from their targets before the puppet is unpinned.

    To handle the health and dying, you can use the BehaviourPuppet.OnCollisionImpulse(MuscleCollision m, float impulse) delegate or BehaviourPuppet.OnCollision(MuscleCollision m) delegate. The former is called only for collisions that damage the pinning forces, the latter is called for every collision.

    Code (CSharp):
    1. public BehaviourPuppet puppet;
    2.  
    3. void Start() {
    4. puppet.OnCollisionImpulse += OnCollisionImpulse;
    5. }
    6.  
    7. private void OnCollisionImpulse(MuscleCollision m, float impulse) {
    8. health -= impulse;
    9. if (health <= 0f) {
    10. puppet.puppetMaster.Kill();
    11. }
    12. }
    Cheers,
    Pärtel
     
  30. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Oh, I see. I loaded into the fresh project but I'll double-check. Thanks.
     
  31. SSSekhon

    SSSekhon

    Joined:
    Jun 3, 2016
    Posts:
    11
    @Partel-Lang Hi thanks, I was doing most of that originally but now use animancer so have my on fsm that handles animations.

    OnCollisionImpulses looks like it will be helpful although I have a custom damage system in place that uses a robust system to access data and act upon the results giving me great results.

    I will hopefully ask more questions soon and really appreciate the responses.

    I'm not sure if you've ever seen fight night champion but I'm playing around looking to get results similar to that where arms slide over body parts when impact is glancing.

    Thanks
    Surinder
     
  32. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    hey partel i am trying to instantiate a puppet using the create puppet in run time script ...when i call it on start it works properly after tweaking it a little ...but i want to call it on update and when i do it generates this error on some muscles "
    NullReferenceException: Object reference not set to an instance of an object
    RootMotion.Dynamics.MuscleCollisionBroadcaster.OnCollisionEnter (UnityEngine.Collision collision) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/MuscleCollisionBroadcaster.cs:95)
    "
     

    Attached Files:

    Last edited: Dec 12, 2019
  33. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    I think you were using an old version of PuppetMaster, because line 95 is empty in the latest. Could you try just updating the package or are you stuck with what you have for some reason?

    Best,
    Pärtel
     
  34. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    Hey Partel I sent you a link to my project download, let me know if you need anything else, thanks!
     
  35. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Omg i just noticed it! yeah i can upgrade however i am worried this may mess up my game! I will try it though! I have one more question ...you mentioned in a previous post about instantiating puppets that "PuppetMaster needs the ragdoll to match with the target positionally when it initiates, so if you need to move the character, move the root that contains both the ragdoll and the target."
    But my AI is moving the Character controller child so if i transfer all the character controller components to the root would be ok? (not sure if i got that right though)
     
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey, sorry didn't have time to look yesterday, will reply to you in a minute...

    Hey,
    That's not OK actually. The PuppetMaster hierarchy is supposed to be moved by PuppetMaster's physical forces only so if you parented it to the character controller, that would mess with the physics. Just make sure the character controller is not working already or is paused when you set up the puppet. Should be all fine if you did it in Start().

    Best,
    Pärtel
     
  37. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Yeah thats what i thought too! the problem is that i want to spawn the clone on update not on start ...something like a mob spawner! (for example "
    if (Input.GetKeyDown(KeyCode.P))
    {
    Transform ragdoll = GameObject.Instantiate(ragdollPrefab, transform.position, transform.rotation) as Transform;
    ragdoll.name = instanceName;")

    any idea how can i make this work?
     
  38. jfonz001

    jfonz001

    Joined:
    Jul 19, 2017
    Posts:
    18
    Thanks Partel, slowing the animation speed fixes the issue!

    Thank you for looking into this!
     
    Last edited: Dec 14, 2019
  39. DaveLloyd

    DaveLloyd

    Joined:
    Nov 15, 2011
    Posts:
    21
    Hi Partel,

    I've just upgraded to PuppetMaster 0.9 and something's changed...

    Previously, I had a scene where a car drive through a ragdoll puppet (in Alive/Active state) and sends it flying. However, now, in the same scene the car drives through the puppet (or even acts as if it hit a wall). From the scene view, you can see the leg colliders have been knocked out of place but the head is unmoved and the skeleton bones are not following the joints. I.e., the muscles are not unpinning.

    As far as I can tell there are no other changes. Any thoughts on where to look to find the problem?

    Thanks,
    Dave
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    Could you please let me know if changing like 275 in PuppetMaster.cs:
    Code (CSharp):
    1. public BehaviourBase[] behaviours { get; private set; }
    to this:
    Code (CSharp):
    1. [NonSerialized][HideInInspector]public BehaviourBase[] behaviours = new BehaviourBase[0];
    helps?

    Looking at my release notes, I can imagine something like this happening if you had the vehicle layer included in BehaviourPuppet's "Ground Layers". If that's not it, would it be possible for you to send a repro?

    Best,
    Pärtel
     
  41. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey, very quick question :)
    is there an easy way to use the stagger behaviour without letting the character fall down? so i somehow just wanna use that tipsy walking to move the character around
     
  42. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Hey and thanks for the fast response!
    So if i comment out this line "PuppetMaster.SetUp(ragdoll, characterControllerLayer, ragdollLayer);" it works without errors but when the copy spawns the puppet falls immediately down leaving the model with no colliders
    However with the line added it keeps the colliders but meshes the hierarchy of the object pretty bad making it incapable to move and having no behaviors! I added photos to show you what i mean!
     

    Attached Files:

  43. DaveLloyd

    DaveLloyd

    Joined:
    Nov 15, 2011
    Posts:
    21
    After some hunting I have a repro:
    - Start with the Puppet Extended demo scene
    - Create a new game object at root and move the ThirdPersonPuppet into it.
    - In the BallShooter script add transform.parent.parent as final parameter to the Instantiate call.
    Now when you fire balls at him just bounce off (at least for me). The balls are now spawned in the new game object as siblings to the ThirdPerson Puppet

    Is there something that expects puppet master characters to be in scene root?

    Cheers,
    Dave
     
  44. DaveLloyd

    DaveLloyd

    Joined:
    Nov 15, 2011
    Posts:
    21
    And a quick question: how do I remove PropMuscles from PuppetMaster at runtime?
     
  45. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    106
    Anyone have advice on integrating PuppetMaster with Emerald AI?
    I noticed that whenever I have a character which I added Puppetmaster to, and then subsequently I try to add Emerald AI to that character (via Emerald Setup Manager), I get the error:

    "ArgumentException: UnpackPrefabInstance must be called with a Prefab instance.
    UnityEditor.PrefabUtility.UnpackPrefabInstance (UnityEngine.GameObject instanceRoot, UnityEditor.PrefabUnpackMode unpackMode, UnityEditor.InteractionMode action) (at C:/buildslave/unity/build/Editor/Mono/Prefabs/PrefabUtility.cs:1622)
    EmeraldAI.Utility.EmeraldAISetupManager.OnGUI () (at Assets/Emerald AI/Scripts/Editor/EmeraldAISetupManager.cs:185)"

    I then tried to add Emerald AI to the character prior to PuppetMaster, and I did not get the above error, but it appears the character just sits in an idle state (even though walking and running states were added to Emerald). Additionally, the character doesn't seem to react to being hit with weapon I had added collider layer to. Previously the character was reacting when I had PuppetMaster only on him.

    Appreciate any guidance folks can give.
     
  46. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117
    Try lowering the muscle and pin weight a little and try again, if it doesn't work. Send pictures of the colliders/puppetmaster and etc so Partel can take a look. A video would be even better.
     
  47. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,556
    Hey,
    If you have "Max Duration" set to Infinity in BehaviourBipedStagger, then it will just keep on staggering until it loses balance. So the problem actually is how to keep the puppet from losing balance. You could increase "Torque Mlp", that is the amount of torque applied to the lower legs to help keep the puppet balanced. Note that this is an external force (not coming from the joints themselves) and might make the simulation seem more unnatural, but it helps to maintain balance. The only other option I can think of would be to attach the pelvis or the spine to a kinematic Rigidbody with a joint, that Rigidbody would then basically be your balance controller. Its what Gang Beasts and similar games do more or less.

    Hey,
    When the ragdoll just falls off at start and does nothing, that is usually because the position of the ragdoll does not match with the animated target. PuppetMaster should log a warning to the Console about that. Usually happens when people instantiate a puppet in runtime, then move it to the spawn position, but they are moving only the character controller or only the PuppetMaster, so the other one is left behind. Then PuppetMaster initiates and finds the dual rig mismatched and fails. If you move the character to the spawn point, make sure to move the root of the character hierarchy to make sure everything is included in the operation.

    Hey,
    It is lines 93, 105 and 117 in MuscleCollisionBroadcaster.cs that check if the root of the collider matches the root of the puppet and if so, ignore the collision.

    Those lines are there to exclude collisions with the puppet's own colliders from processing. When puppets get in contact with each other, there can be hundreds of collision contacts for BehaviourPuppet to process and for the sake of performance, I need to exclude as many invalid/unimportant collisions as fast as possible. Checking the root is the fastest way (but not the safest as you found out the hard way) to know if the puppet is colliding with itself, it doesn't require any GetComponent calls or other expensive checks. I know it's not the best solution, but I still haven't found a fast enough alternative.

    Hey,

    The error comes from Emerald's side, which I don't know about, but that error is probably about calling PrefabUtility.UnpackPrefabInstance on an object that is not a prefab:

    Could try adding this condition to the line that produces the error:

    Code (CSharp):
    1. if (PrefabUtility.IsPartOfPrefabInstance(theGameObjectYouAreTryingToUnpack)) {
    2.  
    3. // The error line goes here
    4.  
    5. }
    The other problems may have been the result of code skipping because of that error.

    Cheers,
    Pärtel
     
  48. DaveLloyd

    DaveLloyd

    Joined:
    Nov 15, 2011
    Posts:
    21
    Thanks for the pointers. It's a little more expensive but would it be sufficient there to test if the PuppetMaster transform is an ancestor of the Collider transform?
     
  49. gliealonso

    gliealonso

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

    I was checking the RaycastShooter Scene, and I was wondering how I could use that for my VR game?

    If I use

    void OnCollisionEnter(Collision collision)
    {
    }

    Then how would I use ?
    broadcaster.Hit(unpin, ray.direction * force, hit.point);

    I was thinking about using
    ContactPoint contact = collision.contacts[0];
    But I don't know how.

    Gabriel.
     
  50. alexkarak

    alexkarak

    Joined:
    Feb 7, 2018
    Posts:
    28
    Well i tried moving the root and the script summons a copy but with meshed up hierarchy (i had a picture attatched in my previews comment) so it doesnt opperate well
    so whaty can i do to fix that