Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  5. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

PuppetMaster - Advanced Character Physics Tool [RELEASED]

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

  1. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    78
  2. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    79
    ----- I fixed this part
    I will check Fix Target Transforms when I get home from work, but I believe the answer is yes to that question. As for the capsule, it was connected to my player object within the player hierarchy that was generated by PM (so just my actual player, not the puppet as well). I think it was my original player collider from before I applied PM. I tried to move it a little and my player just fell. Does my actual player still need the same collider that I was using before applying PM? I think it just became shrunk down after adding PM for some reason. I also think it might be contributing to the crazy jittering as well. I will have to check that also.

    ---- I fixed this part as well
    Should I just be using a normal capsule collider when using PM with Opsive TPC? Should it be right even with the ground? Should I be using some other sort of collider setup?

    -----Fixed this as well
    For some reason, when the collider was tiny on the ground, the puppet was staying with me just fine, now that I made the collider the size it should be on my actual player the puppet is falling through the ground again. I did the "fix muscles" thing 3 times, yet I keep getting the warning each time in the console.

    ---- Edit Good lord, I finally got everything working right on my character as far as being able to move, and having him fall over and what not. For some reason everything under the sun that could possibly be wrongly configured from the automatic setup, was. Then again, that seems to happen quite often.
    ----------------- an ----------------------------------------------------------
    These two I still need help with

    I still have the issue with him eventually starting to jitter up and down really bad like he is having a convulsion, but it starts really slow now and ramps up, it takes a few minutes for it to get bad. A few of the settings are set to Fix Transform, should they not be? My NPC does not do this for some reason, but my character does.

    Also, any idea why Inventory Pro would be having an issue spawning my character? I have it parented and prefabed as it should, in the Spawner I added the parent/prefab, but for some reason when it spawns me,it moves the whole prefab to the spawn point, but the puppet stays there and then falls over, then falls through the ground. If I place my character right on the spawn point and then start it, it will stay and everything is fine, but for whatever reason spawning the prefab, the puppet won't follow.

    Searching back through some of the posts I saw some about pooling the character, would that be a better way to go about it? I tested it out a bit by just adding a pool and the respawning script to my scene and I was able to spawn over and over and everything seemed to stay in place (though initial spawn was still directly on the spawn point, I will test it more tomorrow) but for some reason the Y axis of the puppet object just constantly kept falling even though everything seemed to be fine, I was able to unpin and fall over and then go back. If I put myself in the pool it would stop falling, then I spawned again and it would start to fall again from the same position but I have no idea what it was that was falling.
     
    Last edited: Feb 8, 2018
  3. internethip

    internethip

    Joined:
    Oct 21, 2013
    Posts:
    20
    @Partel-Lang Thx, Teleport() worked a lot better! Had issues with the ragdoll colliding with stuff during the move using transform.position = position;
     
  4. bumd

    bumd

    Joined:
    Aug 20, 2017
    Posts:
    6
    Hello, I sent you the project.

    Looking forward for your findings. I also found something, in unity 2017.2, physics and transform update structure has been changed that I read from here, maybe it is relevant to this problem:

    https://docs.google.com/document/d/1jQzTzJGSQSIcwi7WiP-Ot5mW6N0xqmgKQRGdjbadTM8/edit

    https://forum.unity.com/threads/preview-of-2017-2-features.481949/
    and this
    https://forum.unity.com/threads/2017-2-physics-broken.499886/

    also pushing real low value for fixed timestep as like 0.002, ragdolls are not flying into space anymore when I hit it with the prop, but still not behaving %100 correct to physics forces, they still make unnatural movements and making arc movements on air.
     
    Last edited: Feb 6, 2018
  5. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,546
    Hey,
    I managed to reproduce the issue with the InteractionSystem and picking up. Try enabling "Pick Up" for the event that picks up the prop. That will use the picked up position/rotation as a point to start fading back from, otherwise the hand will start to chase itself around trying to follow a target that is parented to the hand.

    About your bugfix, thanks, it's a good point!
    I wrote the fix like this, avoiding the slow GetComponentsInChildren:

    Code (CSharp):
    1. // Enable collisions between the new muscles and the removed colliders
    2.             if (!internalCollisionsEnabled) {
    3.                 foreach (Muscle newMuscle in newMuscles) {
    4.                     foreach (Collider newMuscleCollider in newMuscle.colliders) {
    5.                         foreach (Collider removedMuscleCollider in muscles[index].colliders) {
    6.                             Physics.IgnoreCollision(newMuscleCollider, removedMuscleCollider, false);
    7.                         }
    8.  
    9.                         for (int childMuscleIndex = 0; childMuscleIndex < muscles[index].childIndexes.Length; childMuscleIndex++) {
    10.                             foreach (Collider childMuscleCollider in muscles[childMuscleIndex].colliders) {
    11.                                 Physics.IgnoreCollision(newMuscleCollider, childMuscleCollider, false);
    12.                             }
    13.                         }
    14.                     }
    15.                 }
    16.             }
    It needs to go to line 223, before muscles = newMuscles; is called.

    Hey,
    Does the jitter still happen when you disable "Update Joint Anchors" in PM?
    Not really familiar with Inventory Pro so I don't know how it spawns stuff or what it does. Pooling is definitely the way to go with puppets, there are loads of calculations done when puppets are initiated and that can be avoided by pooling. Spawning mid-game might give you some hickups.
    Anyway, if you could send me that project or a repro or something I could take a closer look at, that would the quickest solution to those problems.

    Hey,
    Thanks, I'll look into it ASAP. The physics/transform update structure changes messed up the demo character controller in FIK/PM, but that has already been fixed with FIK 1.7 and PM 0.7. Haven't found any other problems with it yet.

    Best,
    Pärtel
     
    RakNet likes this.
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,546
    Hi all,

    Thanks to Bumd, I found a critical bug in the latest version. If you see puppets fly away at a weird velocity when they get unpinned, that is because of a bug in BehaviourFall.cs. Please import this hotpatch

    I also uploaded version 0.71 to the Store.

    Sorry for that mistake!
    Pärtel
     
  7. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    79
    If this were to be used with say 8-10 players, would all of them end up needing their own two collision layers if it were going to be a free for all fight type situation?

    I have also noticed that occasionally when stopping my game the joint broadcasters and the other item don't come off the puppet and I have to go through and remove them all by hand from each item. Any idea what is up with that?
     
    Last edited: Feb 9, 2018
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,546
    Hey,
    No, you can actually have them all on the same layer, BehaviourPuppet will not process collisions that come from colliders in the same hierarchy as the puppet. The two layer approach is used in the demos because most games have factions and it s easier like this to define different collision resistance and handling for friends and foes and stuff like that.

    About JointBreakBroadcasters, I'm a bit confused since they are added to the muscles by PuppetMaster when it initiates in play mode. PuppetMaster.Initiate is a private function and called from either Awake or Start depending on whether the puppet was created in Editor or via script. PuppetMaster.cs does not execute in edit mode so I can't see how those components could remain there after you stopped play mode. Only maybe if you copied the puppet in play mode, stopped the game and pasted it back to the Editor. Any way I could reproduce this?

    Best,
    Pärtel
     
  9. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    79
    Unfortunately, there is no way I can think of to try and duplicate this, as I was simply tweaking some settings of an unrelated component and just started and stopped the game a few times and then noticed there was the triangle wanting signs on all of the components under the puppet hierarchy. That was actually the second or third time it happened. There may be more going on with that though because when it happened this time my character also lost his assigned texture at the same time. I had to go back in and reselect the texture in the material setting of the skinned mesh component. I had not done any copy and pasting of any sort though, only starting and stopping the game.
     
  10. Tega-dumuje

    Tega-dumuje

    Joined:
    Mar 23, 2016
    Posts:
    2
    hey
    I am using puppet master for a melee game , I have tried to replicate the punching scene interaction but I find out that setting my own character creates a more stiff collision i will like to know how the victim dummy its so loosed and not stiff like mine 2018-02-10.png
     
  11. beowulfkaine

    beowulfkaine

    Joined:
    Apr 3, 2014
    Posts:
    100
    Hey everyone, I'm using playmaker with this and I'm wondering if there is a way to change this:

    if (Input.GetKeyDown(KeyCode.D) && !isDead) {
    // Play the death animation
    animator.CrossFadeInFixedTime("Die Backwards", 0.2f);

    to an action in playmaker? This is for a vr game so I want the enemy to do this from being shot
     
  12. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    79
    Please see the attached video. I can't seem to get my puppet to lineup with my player correctly anymore. Fix muscle transform is not working. In the video you will see how the colliders are off and remain so when I pool the character and spawn it again. It also seems to leave a single thing behind once the game starts as well. I hit the fix transform button twice, once before starting the game, once after, but things still are weird. Any suggestion?

     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,546
    Hey,
    If you have textures going missing and stuff like that, it's probably something other than PuppetMaster, I really have no idea, sorry.

    Hey,
    The upper body muscle pin weights have been reduced in the individual muscle settings under PuppetMaster, that's why they are looser.

    Hey,
    They seem to have a rather nice manual on writing custom actions.

    Hey,
    Looks like something changed the pose of the character in Editor. Scrubbing the Animation window while the character is selected might do that for example. Anyway, you can use a script like this:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.Dynamics;
    4.  
    5. public class FixPuppet : MonoBehaviour {
    6.  
    7.     public PuppetMaster puppetMaster;
    8.  
    9.     [ContextMenu("Ragdoll To Target")]
    10.     public void RagdollToTarget() {
    11.         foreach (Muscle m in puppetMaster.muscles) {
    12.             m.joint.transform.position = m.target.position;
    13.             m.joint.transform.rotation = m.target.rotation;
    14.         }
    15.     }
    16.  
    17.     [ContextMenu("Target To Ragdoll")]
    18.     public void TargetToRagdoll() {
    19.         foreach (Muscle m in puppetMaster.muscles) {
    20.             m.target.position = m.joint.transform.position;
    21.             m.target.rotation = m.joint.transform.rotation;
    22.         }
    23.     }
    24. }
    25.  
    Add it to your character, assing PuppetMaster and then right-click on it's header to select whether you want to move the ragdoll to the target or the target to the ragdoll.

    Cheers,
    Pärtel
     
  14. Tega-dumuje

    Tega-dumuje

    Joined:
    Mar 23, 2016
    Posts:
    2
    just wanted to ask if there any future plans to work with the invector templates
     
  15. Nick-Metnik

    Nick-Metnik

    Joined:
    Sep 28, 2013
    Posts:
    8
    Super new to this product, hopefully this isn't a dumb question.

    I'm trying to figure out the intended way to subscribe to the collision events on a puppet master to get "what" and "where" (i.e. ball, hit head).

    Please excuse me if it's in the support materials. I checked but the closest I could find was "broadcasting..." but I'm not sure what to listen for.

    Thank you!
     
  16. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    79
    Thanks man, appreciate it, that seems to have done the trick! Also, when you forget to turn PuppetMaster off and then mount your horse that has a working collision layer with PM, hilarity ensues, lol.

     
    Nick-Metnik likes this.
  17. IDreamofIndie

    IDreamofIndie

    Joined:
    Dec 24, 2014
    Posts:
    34
    I have been trying to figure out what is causing an issue that I'm having with Puppetmaster colliders miss aligning with my mesh when killing the puppet.

    I think I've narrowed it down to being the Grounder FBBIK.
    GroundedOn.png GroundedOff.png
    The Image with the misaligned colliders Grounder FBBIK is ON.

    Could this be what is causing the misalignment?
    Could there something else that would cause the puppet colliders to become misaligned?
    Thanks
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,546
    Hey,
    There's an integration package for Invector's third person controller under Plugins/RootMotion/PuppetMaster/_Integration. It's quite old though, not sure if it will work with the latest Invector stuff.

    Hey, welcome aboard!

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.Dynamics;
    4.  
    5. public class MuscleCollisionHandler : MonoBehaviour {
    6.  
    7.     public BehaviourPuppet puppet;
    8.  
    9.     void Start() {
    10.         puppet.OnCollisionImpulse += OnCollisionImpulse;
    11.     }
    12.  
    13.     void OnCollisionImpulse(MuscleCollision m, float impulse) {
    14.         Debug.Log("Puppet collided with " + m.collision.collider.name);
    15.     }
    16. }
    Hey,
    Nice video, lol. If your puppet falls off the horse, you'll need to make sure to unparent it from it too, otherwise the ragdoll would remain parented to the horse and inherit it's motions.

    Hey,
    Yeah, might be the Grounder, but since the character is dead and ragdolled, you don't need the Grounder anyway, just blend grounder weight out when the puppet dies.

    Best,
    Pärtel
     
    Nick-Metnik likes this.
  19. Nick-Metnik

    Nick-Metnik

    Joined:
    Sep 28, 2013
    Posts:
    8
    Solved my problem. Thank you Pärtel. Love the assets!
     
  20. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    829
    @Partel-Lang,

    Is there a way to rotate individual colliders so they fit my character better? Here is an example, the Forearm colliders need a bit of a rotation...

    Colliders.gif
     
  21. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    79
    Look at his reply to my post just up one, the code should probably help you as it did me.
     
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,546
    Hey,
    There's no way in Unity to rotate colliders, that problem needs to be fixed in the 3d app used for creating the model. The axes of the bones need to be re-oriented so that one of them aligns with the direction towards the next bone. In Unity the only thing you could do is remove colliders from those bones and add them to a child gameobject which you can rotate, but really, it should be fixed on the model side.

    Best,
    Pärtel
     
  23. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    78
    In PuppetMasterHierarchyAPI.cs there is a bug where if the puppet is in disabled mode, the dropped prop is not reenabled when released.

    From RemoveMuscleRecursive(...)

    Code (CSharp):
    1. switch(removeMode) {
    2.             case MuscleRemoveMode.Sever:
    3.                 DisconnectJoint(muscles[index].joint);
    4.  
    5.                 for (int i = 0; i < muscles[index].childIndexes.Length; i++) {
    6.                     KillJoint(muscles[muscles[index].childIndexes[i]].joint);
    7.                 }
    8.                 break;
    9.             case MuscleRemoveMode.Explode:
    10.                 DisconnectJoint(muscles[index].joint);
    11.  
    12.                 for (int i = 0; i < muscles[index].childIndexes.Length; i++) {
    13.                     DisconnectJoint(muscles[muscles[index].childIndexes[i]].joint);
    14.                 }
    15.                 break;
    16.             case MuscleRemoveMode.Numb:

    Fix:
    Code (CSharp):
    1.  
    2. private void DisconnectJoint(ConfigurableJoint joint) {
    3.  
    4.             if (mode == Mode.Disabled)
    5.                 joint.gameObject.SetActive(true);
    6.  
     
  24. dyupa

    dyupa

    Joined:
    Dec 21, 2016
    Posts:
    8
    Hi, Partel!
    Could you tell me please, is there a different way (except through the Inspector) to call specific UnityEvent under Events section in BehaviourPuppet script? I want to count a player's falling by + 1, when he is (for example) at OnLoseBalance event, but I can't realize, how can I do this via code from another script.
    Thank you very much! :)
     
  25. h00man

    h00man

    Joined:
    Apr 17, 2017
    Posts:
    18
    hey partel,
    is there any way to change your character puppet script to add a double jump for the player and when doing the double jump play a different animation for second jump?
    i don't know which part of character controller script is responsible for jumping and addforce to rigidbody upward.i also need my player to be floating in the air for a few seconds exactly like jet pack effect.
    thanks a lot
     
  26. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    829
    Thanks for the tip. I adjusted the model and it's bones, but now the problem I'm having is that it wont display the Capsule collider, only the Box collider when I switch between them using the Ragdoll Editor. Any thoughts on this? Thanks.