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. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm getting the following warning on a few points when using puppetmaster.

    PuppetMaster joint anchors need to be Vector3.zero. Joint axis on Gunny_l_Leg_HipSHJnt is (-0.1, 0.0, 0.0)

    I'm confused by this, my rig has rotations and translations on the joints. when i set these to 0 the collider is way off. Can you help me clarify what needs to be fixed.?
     
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Only joint anchor needs to be zero, not the axes or anything else.

    Bone pivots are usually at where the bones start, so it has been made a limitation to save performance and avoid unnecessary calculations.

    Pärtel
     
  3. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hey, thanks!
    i got it almost working. the only thing i have to figure out is: how can i check which prop type my character currently has attached? there is a field current prop in the "prop root" script but that doesent give me the type number
     
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Code (CSharp):
    1. propRoot.currentProp.propType;
     
    Der_Kevin likes this.
  5. omerselman

    omerselman

    Joined:
    Mar 5, 2016
    Posts:
    20
    Partel;
    I tried to implement unity networking into PM. Cam's , animations and Instantiation sync is okay but transform sync is pain. it moves only forward and right. There is no sync in transform. Already tried your network add on.. Do u have any idea why?.
     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi, cant really guess based on that, can you send me something to take a look at or instructions to reproduce?
     
  7. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I'm using OnCollisionImpulse(MuscleCollision m, float impulse) to isolate collisions between enemies and the player and their props/weapons by checking for the layer of the colliding object (int layer = m.collision.gameObject.layer). I have my Ragdoll layers set to EnemyRagdoll, PlayerRagdoll and my prop capsule colliders set to EnemyProp and PlayerProp. I use the physics matrix to isolate everything correctly and I am assigning the correct Collision Layers in BehaviorPuppet so my ragdolls will collide with each other and the ragdolls will collide with the opposing prop/weapon capsule colliders. It all works except somewhere outside of Prop.cs and after Pickup, the muscle.gameobject.layer is being changed to the ragdoll layer and this prevents OnCollisionImpulse from recognizing the EnemyProp and PlayerProp layers on the prop capsule colliders which are childed objects to the muscle object. So once the prop is attached, the muscle parent becomes EnemyRagdoll and the child capsule collider object is EnemyProp. For some reason when that muscle layer gets changed, only the muscle parent layer is recognized by OnCollisionImpulse and the childed capsule collider object with layer EnemyProp and PlayerProp is no longer recognized.

    I've tested this in runtime by just manually changing the prop muscle gameobject layer back to EnemyProp from it's altered EnemyRagdoll layer, and OnCollisionImpulse on my player will then recognize the collisions for both the EnemyRagdoll and EnemyProp when I test for those individual layers. So I know I have everything setup correctly.


    So I'm trying to prevent my props from having their physics layers changed when they get attached to the PuppetMaster hierarchy using PropRoot.currentProp = Prop.

    I commented out the following section in Prop.cs in the method Public void PickUp().
    Code (CSharp):
    1.  //We don't want this because we want the prop collider to have a different layer
    2.         //muscle.gameObject.layer = myPropRoot.puppetMaster.gameObject.layer;
    3.         //foreach (Collider c in colliders)
    4.         //{
    5.         //    if (!c.isTrigger)
    6.         //        c.gameObject.layer = muscle.gameObject.layer;
    7.         //    //Debug.Log(c.gameObject.layer);
    8.         //}

    Using a debug.Log in that same method, I determined that somewhere else in the PuppetMaster code and after Prop PickUp occurs, you are changing the layer of gameobjects that get attached to the PuppetMaster hierarchy.

    Sifting through your code, I finally found a section in PuppetMasterHierarchyAPI.cs where you make the same layer changes in Public AddMuscle();
    Code (CSharp):
    1. joint.gameObject.layer = gameObject.layer; //@todo what if collider is on a child gameobject?
    2.             target.gameObject.layer = targetRoot.gameObject.layer;
    I'm hesitant to comment this section out because I don't want to break everything. But is there anyway for me to prevent the muscle object of my props from having it's layer changed to the same the same layer as the PuppetMaster ragdoll?

    Thanks
    Allan
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi,
    You are right, I hadn't thought about the necessity to keep the prop on another layer. I was just trying to protect against picking up stuff on random layers. You can remove those lines, I will for the next update anyway.

    But just to keep your layer collision matrix reasonable, remember you can also use tags to identify props and other stuff.

    Cheers,
    Pärtel
     
  9. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    Thanks. I'll comment out those lines as well.

    You are correct. My Layer matrix is becoming large,complex and somewhat unwieldy. I know this is a little off topic but I've always been under the impression that during OnCollision events, comparisons to layer, since it can be stored in an integer is more efficient than using the Find Tag operation. But perhaps there is a way to cache that Find tag operation. Or perhaps I'm just mistaken. What method do you prefer when using tags for collision events?

    Thanks
    Allan
     
  10. shawnblais

    shawnblais

    Joined:
    Oct 11, 2012
    Posts:
    324
    There's CompareTag now, which is performant. Just make sure to store your tag names in a variable somewhere so you're not creating a string each time you check.
     
    Partel-Lang likes this.
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Yes, CompareTag, other than that, checking for layer number is fastest.

    Best,
    Pärtel
     
  12. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    258
    Is something like this possible with puppetmaster:

    Starting at 0:20
    Where the character just stubeling around and is pretty hard to control.
    Drunken mode basically :D
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi!
    Not yet, but I'm researching into stuff like that.

    Cheers,
    Pärtel
     
    looki666 and hopeful like this.
  14. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi again Pärtel,

    Just bought PM and i love it. Great job as always.
    I have one question for you. To make a 3D scroller avoiding the Z Axis movement, in the character controller since it is Rigidbody driven, i can simply freez the Z Axis movement. But the ragdoll can move after colliding with something and make the character get up from the ground in some other point.

    Any way to solve that, and where? I'm not too familiar with the child objects and what i should modify. If i force the character controller to be in Z 0, after get up the ragdoll will jump to 0 if it is away...

    Thanks!
     
  15. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi and thanks for the purchase!
    Do you have the ground collider's layer enabled in the "Ground Layers" of BehaviourPuppet?
     
  16. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi,

    Yes. All is working perfectly. The thing is, do you know how could i clamp the ragdol movement to make it fall just maintaining the z position of the character. Think in a 2.5D game. Only move in the X and Y axis. But since the ragdoll can fall to any direction depending on the collision, how could i restrict a bit that movement? Now i'm just lerping the position of the character to Z=0. But if the ragdoll lands far away, you get a nice smooth sliding of the character...
     
  17. internethip

    internethip

    Joined:
    Oct 21, 2013
    Posts:
    20
    Has anyone used puppet master in a networked environment? Does it work? Is there any information on how it could be done?
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Can't freeze all Rigidbodies, it would make the ragdoll quite weird, but you could create a new gameobject, add a kinematic Rigidbody and a configurable joint, connect it to the pelvis muscle and set Z Motion to Locked.

    Hi,
    There is a UNet integration package in Plugins/RootMotion/PuppetMaster/_Integration
    It contains an example of setting up a puppet with Unity's networking and some scripts.
    I have not made very thorough network testing yet though, it is still in beta.

    Cheers,
    Pärtel
     
    Danirey likes this.
  19. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Great! thanks. I'll try that... good point! ;)
     
  20. DoenitZ

    DoenitZ

    Joined:
    Oct 23, 2012
    Posts:
    16
    Hi to all!

    I just recently discovered this awesome asset, and i'm amazed that this has been pulled off (from what i've seen on the videos) just like Euphoria does! So, great job!!

    My main concern, as of right now: i'm trying to build an FPS using UFPS and Tactical AI (Paragon AI). I know that the integration has been debated on previous posts, but i havent seem to find this specific thing:

    Tactical AI has a Parkour mode, that uses lerping and animation offsets to move the player when it performs a Leap or a Vault over an object.

    From what i've seen, puppetmaster uses physics to update the ragdoll position, have anyone been successful in combining the Parkour features of Tactical AI with puppet master?

    If this is possible, then i would definitely buy this amazing asset!

    Thanks to everyone!!
    Cheers!
     
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi and thanks!
    I haven't tried this before (sooo many third party character controllers) myself, but basically, PM will just make the ragdoll follow the animation unless instructed otherwise so for PM it doesn't matter if the player is parkouring or running or just chilling out. Anyway, if there will be a problem we can't solve, I'll have no problem refunding the purchase.

    Cheers,
    Pärtel
     
  22. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    My puppet is going back into Puppet state about halfway through my getup animations. I am using more detailed GetUpProne and GetUpSupine animations that are about twice as long in time (2 -3 seconds) as the animations you use in your melee demo scene.

    I'm certain I'm just missing a setting somewhere but how do I control when the Puppet goes back into the Puppet state after being in the Unpinned, GetUp states?

    I've looked through all of the Getting Up and Losing Balance settings in BehaviorPuppet and the docs and just can't figure out what determines when the Puppet decides to go back into Puppet state.

    PS: Nevermind, I figured it out. :) It's Min Get Up Duration. The tooltip threw me off because I was thinking from the tooltip that this was the minimum time before the puppet would begin getting up (GetUp Animation). But once I found the section in your code, I realized you SetState(State.Puppet) once getUpTimer is greater than minGetUpDuration. Which means Min Get Up Duration should be about equal to the length of your Getup animation.

    Thanks
    Allan
     
    Last edited: Sep 24, 2016
  23. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    433
    Hi,

    I want to know more about this asset before purchase.

    1. How many ragdolls can a main stream PC handles?

    2. Can we use them in multiplayer game? Is it compatible with other network systems like Forge Networking? ref:https://www.assetstore.unity3d.com/en/#!/content/38344

    3. Any roadmap? How long will it release a production ready version?
     
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi,
    1. I'd say about 10-25 simultaneously active ragdolls, depending on how they are used, how much do they collide with each other and stuff like that.

    2. I have added a basic networking example using Unity Networking, but the networking support still has a long way to go.

    3. I'm currently working on additional behaviours, like stagger and catch fall. Then I got stuff like 2D and VR support and examples on the roadmap among other stuff, but the process will be similar to Final-IK which took 1.5 years to reach 1.0 so its really is a long term commitment for me.

    Cheers,
    Pärtel
     
  25. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,202
    Hi,

    Can I use Puppet Master with my own character colliders, or do I need to use your collider generator for it to work right?

    Thanks.
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi,
    Sure can. The colliders dont matter at all, but PM requires ConfigurableJoints to be used. You can convert to configurables automatically if you select the root of the ragdoll and go "GameObject/Convert To Configurables".

    Best,
    Pärtel
     
  27. internethip

    internethip

    Joined:
    Oct 21, 2013
    Posts:
    20
    In a fighting game, where you have one character attack with a kick and one character that takes the kick. In my case both the attacker and the defender receives the collision. How can I make sure that only the defender gets that collision?

    Maybe you could make the leg kinematic? Or maybe ignore collisions only on the leg? Or maybe set the collision resistance on the leg really high during the attack?

    I would ideally want two characters to be able to attack each other simultaneously as well.

    Any other people who worked with this issue before and what solutions do you have?
     
  28. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi!
    Thats a job for Boosters. Define a Booster in your script that calls the attack animation and call booster.Boost(BehaviourPuppet puppet) when the attack starts; You can fill in what the Booster does in the editor, it can give collision immunity to some muscles so the kicker doesn't get damage from his own kick.

    Best,
    Pärtel
     
  29. internethip

    internethip

    Joined:
    Oct 21, 2013
    Posts:
    20
    I cannot get this to work.

    I have boostFalloff of set to 0

    I added a booster to my script:
    Code (CSharp):
    1.         public Booster booster;
    2.  
    Which I filled in like this:
    Code (CSharp):
    1.  
    2. {
    3.   Booster:
    4.   {
    5.     Full Body: false
    6.   },
    7.   Muscles:
    8.   {
    9.   },
    10.   Groups:
    11.   [
    12.     Leg,
    13.     Foot
    14.   ],
    15.   Immunity: 1,
    16.   Impulse Mlp: 0,
    17.   Boost Parents: 1,
    18.   Boost Children: 1,
    19.   Delay 0.3,
    20. }
    21.  
    When I go into my attack state(my own FSM solution) I run once in the first frame:
    Code (CSharp):
    1. booster.Boost(puppet);
    Then I print immunity from my attacking muscle each frame(muscle 2 is in the Leg group):
    Code (CSharp):
    1. print(puppet.puppetMaster.muscles[2].state.immunity);
    Then I have on my attacking muscle GameObject:
    Code (CSharp):
    1.  
    2. void OnCollisionImpulse(MuscleCollision m, float impulse) {
    3.         print("imp: " + impulse + " ind: " + m.muscleIndex);
    4. }
    5.  
    And then the attacker(in its attack state with immunity set to 1) hits another ragdoll with its attack and falls to the floor.

    Which results in this console log:
    Code (CSharp):
    1.  
    2. 1 UnityEngine.MonoBehaviour:print(Object) (68)
    3. imp: 103.6316 ind: 2 UnityEngine.MonoBehaviour:print(Object) (1)
    4. imp: 12.46975 ind: 2 UnityEngine.MonoBehaviour:print(Object) (1)
    5.  
    So in my mind this means:
    Immunity is 1, Puppet should be immune to collisions and knockouts.
    Collisions register as if immunity does not matter, collisions are based on collisionresistance
    Knockouts still happens as if immunity does not matter

    That should be categorized as a bug or?
     
    Last edited: Oct 1, 2016
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hmm.. Could you tell me what happens when you enable full body in the booster?
    Also, set Impulse Mlp to 1. If its 0, the leg will not deal any damage to the other puppet.

    Best,
    Pärtel
     
  31. internethip

    internethip

    Joined:
    Oct 21, 2013
    Posts:
    20
    It works now. I had to have mlp at 1.
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi all,
    PuppetMaster 0.5 is ready for download! :)

    It has a new cool demo where you can shoot bones off a skeleton puppet, so PM now supports joint breaking properly.
    Also some other stuff, check out the release notes.

    Cheers,
    Pärtel
     
  33. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi pärtel,

    Could you give me a tip to get explosions working with puppet master? I can't make it work the old way..


    And this new update with the muscle killer is AWESOME!!! Just need a bit of learning to make the puppet fall to the ground constantly if the legs muscles are disabled. Any idea? If you shoot to the legs, the puppet will try to get up and it will with two flying dead legs.

    Thanks a lot!
     
    Last edited: Oct 15, 2016
  34. internethip

    internethip

    Joined:
    Oct 21, 2013
    Posts:
    20
    I want to move the charactercontroller via setting a position in script. But there is some update that pulls the character controller and back to its original position. How do you move the character controller? This is a, once off, "respawning" type of thing.

    Edit:
    Found puppet.reset() function. Works great. thanks.
     
    Last edited: Oct 16, 2016
  35. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Thanks, what exactly did you mean by getting explosions working? You could foreach puppetMaster.muscles and call AddExplosionForce on all muscle.rigidbody-s.
     
  36. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Exactly that! Maybe something like this? :

    Code (CSharp):
    1.     IEnumerator receiveExplosion(float force, float radius, Vector3 position)
    2.     {
    3.        
    4.         foreach(var m in puppetMaster.muscles)
    5.         {
    6.             if (m.rigidbody)
    7.             {
    8.                 m.rigidbody.AddExplosionForce(force, position, radius, 1f);
    9.             }
    10.         }
    11.         return null;
    12.     }
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    You got it ;)
    But you dont have to check for m.rigidbody, it will always be there.
     
    Danirey likes this.
  38. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    ahoi partel!
    the new skeleton demo is damn nice! can i also limit it somehow to a specific muscle/group?
    it kinda breaks when i only have the arm for example as separate mesh carbbom_arm5.gif

    i also have a question regarding explosions:
    at the moment, my Explosivs are not that effective...
    carbbom_grenade.gif

    the explosion script look simple as this:
    Code (CSharp):
    1. Vector3 explosionPos = transform.position;
    2.         Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
    3.         foreach (Collider hit in colliders) {
    4.             Rigidbody rb = hit.GetComponent<Rigidbody> ();
    5.  
    6.             //Add force to nearby rigidbodies
    7.             if (rb != null)
    8.                 rb.AddExplosionForce (power, explosionPos, radius, 3.0F);
    9.            
    which is actually almost the same as what got described a few posts before, right?
     
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    What are you using for cutting the body parts, code or have you set joint break forces?

    About the explosions, it is the same script as in the user manual for AddExplosionForce, so it might be the best solution.
     
  40. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hey, your SkeletonShooter.cs from the latest version. but i already found a solution. just added a tag check to the raycast
    Code (CSharp):
    1.     if (Physics.Raycast(ray, out hit, 100f, layers) && hit.transform.tag == "Head") {
    so that i can only shoot away the head of the skeleton and not everything. so if anybody will have the same problem, there you go ;)

    about the explosion: thats weird, so what could be the reason that my explosion doesent "kill" the character? i

    here is the full script:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Grande : MonoBehaviour {
    5.  
    6.     [Header("Explosion Options")]
    7.     //Radius of the explosion
    8.     public float radius = 25.0F;
    9.     //Intensity of the explosion
    10.     public float power = 10000.0F;
    11.  
    12.     public Transform explosionDirtPrefab;
    13.  
    14.     //Used to check what surface the
    15.     //grenade is exploding on
    16.     string groundTag;
    17.  
    18.  
    19.  
    20.     // Use this for initialization
    21.     void Start () {
    22.  
    23.     }
    24.  
    25.     // Update is called once per frame
    26.     void Update () {
    27.  
    28.         if (Input.GetKeyDown(KeyCode.A)) {
    29.  
    30.         Instantiate(explosionDirtPrefab, this.gameObject.transform.position , Quaternion.identity);
    31.  
    32.         Vector3 explosionPos = transform.position;
    33.         Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
    34.         foreach (Collider hit in colliders) {
    35.             Rigidbody rb = hit.GetComponent<Rigidbody> ();
    36.  
    37.             //Add force to nearby rigidbodies
    38.             if (rb != null)
    39.                 rb.AddExplosionForce (power, explosionPos, radius, 3.0F);
    40.  
    41.         }
    42.  
    43.         }
    44.     }
    45. }
    46.  
    maybe you can try this in the melee scene if you have some time?
    i placed it on a sphere near the character.

    one idea would be to use the same stuff that you use in the "Puppet Raycast" scene and the RaycastShooter.cs - but shooting a ray in all directions with Physics.SphereCast - but i think that will only have an effect on the first puppet muscle that gets hit?
     
    Last edited: Oct 19, 2016
    AntonioModer likes this.
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Oh, you also have to call behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned) to blow away a puppet.
     
    Der_Kevin likes this.
  42. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    ok, thanks. that works now . for one character - just one more question. how do i acess the behavior puppet to unpinned for all puppets in the Physics.OverlapSphere?

    i know how to access all puppetmaster muscles and the character controller since they all have already a collider.
    but not the behavior puppet since this doesn't have a collider on it. i could just add a box collider to the behavior puppet object. so that way it also gets recognized by the Physics.OverlapSphere but i somehow think this is kinda wrong to do?
     
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Before you add force to a collider, check if its on a layer that is for the puppets,
    then find MuscleCollisionBroadcaster on that collider's attachedRigidbody, that has a reference to the PuppetMaster, and you'll find BehaviourPuppet from puppetMaster.behaviours.
     
    Der_Kevin likes this.
  44. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    thanks again. now it works fine, thanks! :)

    i have to annoy you sadly with two more questions. both are related to props:

    so in the PropPickUpTrigger.cs I turned the private CharacterPuppetcharacterPuppet; into a public CharacterPuppetcharacterPuppet;
    so now i can see which character controller and player number picks up the prop and if the current prop is in use. thats cool, but when the character falls down or drops the prop it wont display null. it keeps the last chracter Puppet in that field. how can i change it to check if a prop is used or not.

    can i somehow turn off the ability to pick up a prop? so for example as long as i am performing an action or hold down a button, i can not pick up any prop.
     
  45. Partel-Lang

    Partel-Lang

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

    characterPuppet could become null only if that instance were destroyed, it is declared in declaration space just for not allocating memory each time something is picked up. That scipt is for triggering pickups, so its not the place for checking if any props are used or not. You can use prop.isPickedUp to check if a prop has been picked up or not.

    About the other question, it is not a generic problem, so it should be handled by one of you own scripts. For example you could extend CharacterPuppet and add a bool "canPickUp" and toggle it on/off depending on your needs. Then you could also make your own version of the trigger script that checks for canPickUp before it calls to pick up the prop.

    Cheers,
    Pärtel
     
    Der_Kevin likes this.
  46. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    thanks again for the hints! works perfect now
     
  47. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    313
    I'm confused about the proper way to move an animated AI character while using PuppetMaster

    1. Set the GameObject translation directly; do not add a RigidBody or collider. Works, but because there is no relationship between this and physics, the character slides around on the ground still walking, even while fallen over. I could turn off the AI when fallen over, but I would prefer to use an approach that accounts for physics.
    2. Follow the demo, add a RigidBody to the GameObject and set the velocity of the RigidBody. This stops sliding around fallen over. However,
    2A. If I turn on gravity my character immediately crumples to the floor, even though pinning is set at 1.
    2B. If I turn off gravity it works, but the character has no gravity and will float in the sky.
    2C. If I turn on gravity and add capsule collider like the demo, the character falls over and rolls around like a capsule shaped object would as soon as he moves.

    I was looking at the PuppetExtended demo and it looks like it doesn't matter if gravity is on or off on the RigidBody. Also the scripts seem to reimplement gravity in CharacterThirdPerson FixedUpdate()

    What is the best and/or simplest approach where I can move the character still subject to physics, still have gravity, and do not have my character immediately crumple to the floor when gravity is on?

    BTW I'm not using CharacterThirdPerson or any related character controller scripts on my AI characters.
    BTW2: I also bought FinalIK but am only using AimIK so far
     
    Last edited: Oct 23, 2016
  48. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    313
    This is a basic question but I'm wondering how position and orientation interrelate with a "Dual Rig" Gameobject setup. For example, after rolling down a hill using ragdolls there are now two transformations: gameObject.transform.position still at the top of the hill, and the PuppetMaster muscles at the bottom of the hill.

    How do I keep gameObject.transform.position in synch with PuppetMaster's physical position?
    How do I directly tell PuppetMaster of a new position?
    Is there an efficient way to read PuppetMaster's physical position from outside of using Behaviors?

    Ideally there is one function I can use to get the current transform from PuppetMaster, and I'll just use that instead of gameObject.transform.
     
  49. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi all!

    Just wanted to show you how cool is this asset. Pärtel, this is awesome, and i don't even know how to use it propperly.

    Thanks a lot and keep doing great plugins! ;)

     
    Last edited: Oct 24, 2016
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    The simplest would be to use Unity's CharacterController or the one provided in Standard Assets.
    I'm not sure what makes the character crumple to the floor when you enable gravity, maybe it collides with the ground and the ground's layer is in the "Collision Layers" of BehaviourPuppet?
    You can disable a capsule from falling over by constraining its rotation in the Rigidbody component.

    Hi!
    BehaviourPuppet handles this automatically by just moving the gameobject.transform.position to where the pelvis rigidbody is before it starts the getting up procedure. If you are not using that, you can also just write
    Code (CSharp):
    1. gameObject.transform.position += puppetMaster.muscles[0].rigidbody.position - puppetMaster.muscles[0].target.position;
    Then make a raycast or something to put gameObject.transform on the ground vertically.

    Hey!
    Awesome work, thanks for sharing! Looks like those guys bad guys are really fun to kill! :D

    Cheers,
    Pärtel
     
    Danirey likes this.