Search Unity

PuppetMaster - Advanced Character Physics Tool [RELEASED]

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

  1. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Strange... Have you tried with no interpolation on the controller? I mean maybe the ragdoll is trying to interpolate towards an interpolated target resulting in "double interpolation". When using Normal mode, animation following actually lags a frame behind just because in Unity the Animator updates after the physics so there is no way for me to read the pose to follow before the next frame.

    What do you have for "Normal Mode" in BehaviourPuppet?

    Do you have your puppet in flat or tree hierarchy and do you have interpolation on the pelvis only or all muscles?
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hello! :)

    1. tried no interpolation on controller - result becomes a jerking horror story (far worse) - also bear in mind that I don't have the ragdoll as a child of the controller, the puppet is parent = null, which helps when pressing against scenery etc...

    2. it's a flat hierarchy & all set to interpolate on puppet muscles

    3. I don't use or have behaviour puppet...
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    OK, not having behaviourpuppet on it will make it easier to debug at least.

    I'm trying to make a scene to reproduce this, so far no luck. Could you please take a look at this scene and see if there is anything different from your own setup? Hit SPACE to jump.

    Pärtel
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hi, Not sure what I should be doing with that scene? It is empty and pink with basic code to make any rigidbody jump. All of that is smooth my end, my controller is very smooth (for example if the puppet is set to kinematic or weight for anim is 0).

    Did you upload the right example? :)

    The issue seems to be just related to the puppet itself. Perhaps I should destroy the puppet and try making it again from scratch...
     
  5. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Import it to a project with PuppetMaster already inside.

    Pärtel
     
  6. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hey,
    i am actually not sure if this is a puppetmaster related question but, how would you do a slippery floor with the example character controller?
    i am not talking about the stagger stuff but something more simple that the character is sliding a little bit more into the facing direction after i stop controlling him? i thought about changing the friction values from the character controller but that seam to have no effect?

    thanks!

    edit: i kinda hacked it together by putting this script on the character: http://pastebin.com/xB009m65

    and uncommented all velocity related stuff in the CharacterThirdPerson.cs like this:
    Code (CSharp):
    1. private void MoveFixed(Vector3 deltaPosition) {
    2.             // Process horizontal wall-running
    3.             WallRun();
    4.            
    5.             //Vector3 velocity = deltaPosition / Time.deltaTime;
    6.            
    7.             // Add velocity of the rigidbody the character is standing on
    8.             //velocity += V3Tools.ExtractHorizontal(platformVelocity, gravity, 1f);
    9.            
    10.             if (onGround) {
    11.                 // Rotate velocity to ground tangent
    12.                 if (velocityToGroundTangentWeight > 0f) {
    13.                     Quaternion rotation = Quaternion.FromToRotation(transform.up, normal);
    14.                     //velocity = Quaternion.Lerp(Quaternion.identity, rotation, velocityToGroundTangentWeight) * velocity;
    15.                 }
    16.             } else {
    17.                 // Air move
    18.                 //Vector3 airMove = new Vector3 (userControl.state.move.x * airSpeed, 0f, userControl.state.move.z * airSpeed);
    19.                 Vector3 airMove = V3Tools.ExtractHorizontal(userControl.state.move * airSpeed, gravity, 1f);
    20.                 //velocity = Vector3.Lerp(r.velocity, airMove, Time.deltaTime * airControl);
    21.             }
    22.            
    23.             if (onGround && Time.time > jumpEndTime) {
    24.                 r.velocity = r.velocity - transform.up * stickyForce * Time.deltaTime;
    25.             }
    26.            
    27.             // Vertical velocity
    28.             Vector3 verticalVelocity = V3Tools.ExtractVertical(r.velocity, gravity, 1f);
    29.             //Vector3 horizontalVelocity = V3Tools.ExtractHorizontal(velocity, gravity, 1f);
    30.  
    31.             if (onGround) {
    32.                 if (Vector3.Dot(verticalVelocity, gravity) < 0f) {
    33.                     verticalVelocity = Vector3.ClampMagnitude(verticalVelocity, maxVerticalVelocityOnGround);
    34.                 }
    35.             }
    36.  
    37.             //r.velocity = horizontalVelocity + verticalVelocity;
    38.            
    39.             // Dampering forward speed on the slopes
    40.             float slopeDamper = !onGround? 1f: GetSlopeDamper(-deltaPosition / Time.deltaTime, normal);
    41.             forwardMlp = Mathf.Lerp(forwardMlp, slopeDamper, Time.deltaTime * 5f);
    42.         }
    for now it works - but maybe there is a cleaner solution?
     
    Last edited: Dec 7, 2016
  7. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    My character, with all scripts other than PuppetMaster disabled, slowly slides across the floor. I tried to debug this but can't figure out where the velocity is initially coming from.

    The closest I could get to the velocity in the code was in Muscle.cs, at this line:
    Vector3 force = -rigidbody.velocity + p;
    + rigidbody.velocity "(0.2, 0.1, -0.1)" UnityEngine.Vector3

    If I use HighFriction(); from CharacterBase it helps, but the character still slides a little during certain periods of the animation.
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi,
    You could add a private Vector3 lastHorV;
    Then add this to MoveFixed before the line r.velocity = horizontalVelocity + verticalVelocity;

    Code (CSharp):
    1. horizontalVelocity = Vector3.Lerp (lastHorV, horizontalVelocity, Time.deltaTime * 3f);
    2.             lastHorV = horizontalVelocity;
    Its basically adding an acceleration for horizontal velocity.
    Smaller multiplier for Time.deltaTime would result in less friction. You could also try SmoothDamp and MoveTowards instead of Lerp for different look and feel.

    Hi,
    Could you specify, is it the character controller that is sliding or is it the unpinned ragdoll that is sliding on the floor?
     
    Der_Kevin likes this.
  9. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    alright, thanks! thats working already quite good.

    uhm, i got another one :) this time regarding props.

    how can i mount a prop on two pins/points?
    for example having a long stick like darth maul which needs to be hold with two hands.
    i thought this would be handled by the additional pin but i think i cant attach the additional pin to the left hand?
     
  10. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    What's the best way to teleport the puppetmaster from one place to another, I'm getting unreliable results when I try disabling puppetmaster or the behaviours when i turn them back on.
     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi,
    Just add a joint to the prop and connect it to the other hand in script. No need for a muscle there really.

    Hi,
    Please check out the "Puppet Respawning" demo. Respawning.cs has your answer.

    Best,
    Pärtel
     
  12. shahzaib

    shahzaib

    Joined:
    Dec 14, 2013
    Posts:
    32
    Hi Peter,

    This looks a wonderful asset to have! Wondering if it is possible to use it with UNET? and if so, is it easy to do so?
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi,
    Yes, it is possible. I have a basic UNET integration package under Assets/Plugins/RootMotion/PuppetMaster/_Integration
    It's quite basic, but will get you started, I have better networking support on the roadmap.

    Best,
    Pärtel
     
  14. shahzaib

    shahzaib

    Joined:
    Dec 14, 2013
    Posts:
    32
    Cool! Also, is there a free Puppetmaster version for non-commercial use or even trial? :)

    Thanks for replying.
     
  15. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hi,
    No, sorry. But if you are unable to achieve what you wanted to with PM, I have no problem refunding the purchase.

    Best,
    Pärtel
     
  16. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    okay, i think i am doing something completely wrong here...
    hockeypin.gif
    :D

    so, what i did so far:
    - in the "Prop Melee" Game Object from the melee scene i just added another Config. Joint to the PropMelee Object. so i have two on this object.
    - now i think this is useless: i edited the prop.cs to this: http://pastebin.com/js1fEZK7
    so that i have a muscle 1 and muscle 2 - also made some minor changes to the PropMelee.cs and PropRoot.cs but only changed "muscle" to "muscleone" i think
    - so now, when the character is entering the trigger, only the first muscle get set to the R Forearm.
    - still, if i drop the L Forearm into the Second Conf. Joint as Connected Body, the stuff fro the gif above happens

    ...so iam kinda lost :D
     
  17. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    Is there any way to increase the rigidity/stiffness of individual prop muscle joints. When my characters engage in combat with sword and shield, the shield in particular is pretty floppy. Using collision resistance and layers, I can control the damage done on my character. I can also increase Puppet Master muscle Spring during a block animation to improve his resistance to an attack. But none of those things seem to effect the stiffness or rigidity of the prop muscle joint. The shield seems to remain mostly floppy no matter what I do. I like how I have all of the joints setup as a whole so I'm just looking for a way to increase the stiffness of specific muscle joints.

    I also have an issue where after a certain amount of time engaged in combat, my sword occasionally loses it's root origin position. In other words, it's not perfectly positioned in the hand anymore. I still have not figured out what causes it or how to correct it during runtime. So I'm hoping you may have a suggestion of something I can do to either prevent it or to fix it during runtime.

    Thanks
    Allan
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey,
    Are you sure the left hand is on the stick properly at the time you connect the joint? You might need to set anchor and connectedAnchor manually if they end up wrong.

    Hey,

    There are individual muscle settings if you expand the Muscles on the bottom of PuppetMaster. There are also group overrides in BehaviourPuppet in which you can set up individual collision resistance and stuff like that for each muscle group. Also try increasing Solver Iteration Count in PuppetMaster, might be just that the joint chain is too long for PhysX to solve the end joints properly, the longer the chain the sloppier it gets.

    I have not seen any props drift away from hand. If that happens again, could you pause the game and take some screenshots of the ragdoll and the sword, copy the character root in play mode, stop the game and paste it back to an empty scene. Then if you could package it and send it to me, it would be something for me to take a look at.

    Best,
    Pärtel
     
  19. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    I was adjusting solver iteration count during runtime and just received this error for the first time. It looks like it's in PuppetMasterHierarchy.cs. I think it happened when my character dropped his props due to a collision. So far I have been unable to recreate the error consistently but it may be happening because I use StateMachineBehaviors during many of my animations which I think are animation event callbacks.

    Destroying components immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead.
    UnityEngine.Object:DestroyImmediate(Object)
    RootMotion.Dynamics.PuppetMaster:RemoveMuscleRecursive(ConfigurableJoint, Boolean, Boolean, MuscleRemoveMode) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterHierarchyAPI.cs:143)
    RootMotion.Dynamics.BehaviourBase:RemoveMusclesOfGroup(Group) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/Behaviours/BehaviourBase.cs:349)
    RootMotion.Dynamics.BehaviourPuppet:SetState(State) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/Behaviours/BehaviourPuppetStateSwitching.cs:65)
    MyGrab:OnCollisionEnter(Collision) (at Assets/MyScripts/PuppetMaster/MyGrab.cs:64)

    Thanks
     
  20. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    thanks, the Anchor was the problem. now its working :)
     
    Partel-Lang likes this.
  21. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Looked at the respawning code and it doesn't seem to work for my specific case. It works if everything is sitting still but when my character is moving the respawning will move the the location I set but then in the next frame move about half way between the original position and the new position. Is there a more reliable way to set the new location without teleporting half way between or whererever it decides to teleport.
     
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey,
    Its probably a problem that has been solved already, sent you a link in a conversation.

    Hmm, cant think of anything that would move it half way back the next frame.. What kind of a character controller are you using? Perhaps the character controller has its own internal state of where the character should be or something and tries to move it back there?

    Best,
    Pärtel
     
  23. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Yea, it looks like it's in my code somewhere, who knows where lol. I can't get it to duplicate in your demo.
     
  24. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    Suggestions for Performance Improvements:
    - I would like to see the ability to turn off OnCollisionStay and OnCollisiontExit in MuscleColliisonBroadcaster.cs with a method other than simply commenting out that code. (Since this requires me to remember to do that every time PuppetMaster is updated.) What would be great is the ability to turn those on and off during runtime as needed with code and possibly some kind of bool check in the PuppetMaster.cs or PuppetBehavior.cs inspectors.
    (I use your OnCollisionImpulse event extensively to detect ragdoll collisions and turning OnCollisionStay off in particular is a big deal)

    Thanks for the suggestion regarding Rigibody.SolverIterations. It does make a difference for my shield stability/stiffness. However it makes such a huge difference in impulse collisions, that I'm still tweaking values trying to find the right balance. I determined that it's better to just make that change for the specific prop rigidbody instead of the entire ragdoll. Which leads me to my second performance request.

    - The ability to adjust during runtime rigidbody.solverIterations for each muscle rigidbody individually. (Since this is an option that can be adjusted per rigidbody, I think it might help with props to have the ability to adjust it per rigidbody instead of for just the entire ragdoll.)

    Thanks
    Allan
     
    Last edited: Dec 17, 2016
  25. dwaldrum

    dwaldrum

    Joined:
    Jun 20, 2015
    Posts:
    48
    Any update on the stagger behaviour? We're in need of something exactly like that and are going to start working on it, but it would be great to have a starting point even if it's unfinished?
     
  26. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    ahoi :)
    is it possible to use the muscle remover/sekelton shooter with a skinned mesh renderer? cause when i use the aproach from the demo scene, with a normal mesh renderer, it looks like this:
    zomb_notskinned.gif
    so it works fine, but the body parts are not connected anymore.
    with a skinned mesh renderer the body parts are connected, but dont disconnect.

    zomb_skinned.gif

    here are my settings if its might be useful:
    zomb_settings.gif
     
    AntonioModer likes this.
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey, thanks for the feedback!

    The performance loss of having OnCollisionStay/Exit can not be avoided entirely without commenting out those methods entirely. OnCollisionStay will still allocate memory and hurt your game even if it is empty. It is something Unity is working to solve I have heard.

    But the next best thing, there is a top secret WIP tool you can use. Add a PuppetMasterSettings component to a gameobject in your scene. It will affect all PuppetMasters in that scene and it enables you to switch off Stay/Exit processing.

    Increasing solver iterations makes the joints stronger, so decreasing "Muscle Spring" helps to get back to the results you had before.

    There is no way to set solver iterations for individual Rigidbodies if they are connected by Joints, its a PhysX thing.

    Hey,
    Give me a day or 2, I'll package up what I have so you can get started. I hope I get the time to pick that up soon too.

    Hey,

    I have not tried to solve that yet, have no idea. Its a common problem with severing limbs in games in general I guess, so maybe there is an article on that, that could be found somewhere on the internet.

    Perhaps having multiple skinnedmeshrenderers or some shader magic, where you can mask out body parts, then have normal renderers for each body part and attach them to the broken bones.

    Cheers,
    Pärtel
     
  28. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    alright, thanks! good to know. thought i was to dumb to set up the body parts correct :)
     
  29. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Der_Kevin,

    I was waiting for Partel to post about this before I chimed in. Severing Skinned Meshes is a lot more complicated than just breaking apart joints. You have to remap meshes and UV textures to new models etc. There is a Asset on the Asset store called URG! that does it for you. And there is a free version you can check out as well as paid versions (that are pretty inexpensive). I've played with it in previous projects and it does work. Here is the link to the Free version:
    https://www.assetstore.unity3d.com/en/#!/content/2026

    I may end up incorporating it into my project since I'm attempting to build a combat game but Puppet Master, Final IK and Behavior Designer are complex enough that I'm already over taxing my little brain. So URG! will likely be something I consider adding late in the development cycle as sort of an effects add on.

    Allan
     
    Partel-Lang and Der_Kevin like this.
  30. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    hey allan!
    thanks for the answer! will definitely have a look at it - i played around with the free version without any decent result :D guess i need the dev. version to see what is going on there.
    but still, thank you!
     
  31. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey :)
    uhm, quick question again, is it possible to change the pinweight for each Muscle group at once?
    so for example set all pin weights of the arms and Hands to 0?
     
  32. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    143
    Good afternoon (at least here in Europe :) )
    I am trying to implement your fantastic plugin with the Third Person Controller from opsive. It works fine when i use it as explained in the tutorial, BUT (very big one) when i use the integration with Apex Path (provided by Opsive) the character, driven now by the Ai of apex path, fly away and I dont know why!

    The opsive integration with apex is done through a script (something like movement bridge, or similar).

    Could you PLEASE help me? I really want to use it for the AI too.

    Thanks in advance
     
  33. dwaldrum

    dwaldrum

    Joined:
    Jun 20, 2015
    Posts:
    48
    Have you made sure you have a grid created? If not your ai character will stand there for a minute then just disappear. The process should be super simple, add an apex controller to your ai, something like the wander ability. Then add the movement bridge from the integration. When you add an apex controller it will create a new game object in your scene. On this game object is the grid system, make sure you turn on the grid and set the size properly for your ground, and map the layers properly. Apex has some good getting started tutorials for this.
     
    Partel-Lang likes this.
  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey,
    Yes, use PuppetMaster.SetMuscleWeights(...).
    All the methods and their overrides are in PuppetMasterMuscleAPI.cs or of course in the Script Reference.

    Hey,
    Usually when puppets fly away is because the character controller raycasts against the colliders of the ragdoll to find ground or whatever. Make sure there are no layer masks in the character controller that include the ragdoll layer.

    Cheers,
    Pärtel
     
    Der_Kevin likes this.
  35. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    Hello Pärtel,

    I am new to PuppetMaster and Unity, but I have noticed that with the 5.5.0f3 build of Unity, the Network Puppet (Dummy) models are not visible in the editor. They are visible in 5.4.x builds. I am comparing using the _DEMOS/Networking/Network Puppet scene. Are you aware of this issue and do you know of a good fix/workaround?

    Thanks,
    Tony
     
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey,
    Opened 5.5.0f3, imported PM, imported the UNet integration package, ran the "Network Puppet" demo scene, everything seemed to be OK, saw a dummy punching there. Have you edited the demo scene in any way?

    Cheers,
    Pärtel
     
  37. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    Thanks for the response. To be clear: The Dummy model is not visible in the editor. It is visible when the scene is running, however. Are you saying the dummy model is visible in your editor window? I failed to mention I am running on Windows x64.

    Update:
    Looks like the Character1 layer got disabled somehow in my project when upgrading to 5.5. The model is showing now that I have enabled it again.
    Best regards,
    Tony
     
    Last edited: Dec 30, 2016
  38. SammmZ

    SammmZ

    Joined:
    Aug 13, 2014
    Posts:
    174
    Hey! Thanks for the awesome tool. I'm just starting to explore the demo content and have question. I pinned another hand in the "hanging" example and when I stretch it off the limits the puppet gone wild. Is there an easy way to keep puppet calm when it's overstretched?
     
    AntonioModer likes this.
  39. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    Just a heads up but I am occasionally still receiving the following errors even after the patches you provided:
    This time it occurred during a grab when the other puppet was being unpinned. In Grab.cs, at line 50 within the OnCollisionEnter (otherPuppet.SetState(BehaviourPuppet.State.Unpinned); // Unpin
    I'm using a modified version of Grab.cs but the error fires at the same line of code.

    It looks like the use of DestroyImmediate at lines 142 and 143 in PuppetMasterHierarchyAPI.cs is not allowed.

    Here are the errors:
    Destroying components immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead.
    UnityEngine.Object:DestroyImmediate(Object)
    RootMotion.Dynamics.PuppetMaster:RemoveMuscleRecursive(ConfigurableJoint, Boolean, Boolean, MuscleRemoveMode) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterHierarchyAPI.cs:142)
    RootMotion.Dynamics.BehaviourBase:RemoveMusclesOfGroup(Group) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/Behaviours/BehaviourBase.cs:349)
    RootMotion.Dynamics.BehaviourPuppet:SetState(State) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/Behaviours/BehaviourPuppetStateSwitching.cs:65)
    MyGrab:OnCollisionEnter(Collision) (at Assets/MyScripts/PuppetMaster/MyGrab.cs:70)

    and

    Destroying components immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead.
    UnityEngine.Object:DestroyImmediate(Object)
    RootMotion.Dynamics.PuppetMaster:RemoveMuscleRecursive(ConfigurableJoint, Boolean, Boolean, MuscleRemoveMode) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterHierarchyAPI.cs:143)
    RootMotion.Dynamics.BehaviourBase:RemoveMusclesOfGroup(Group) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/Behaviours/BehaviourBase.cs:349)
    RootMotion.Dynamics.BehaviourPuppet:SetState(State) (at Assets/Plugins/RootMotion/PuppetMaster/Scripts/Behaviours/BehaviourPuppetStateSwitching.cs:65)
    MyGrab:OnCollisionEnter(Collision) (at Assets/MyScripts/PuppetMaster/MyGrab.cs:70)

    These two errors fire twice and the game continues. It's not a warning message but a red error.

    What I don't understand is if DestroyImmediate is not allowed during physics contact, then why doesn't this error occur all of the time. I wonder if it has something to do with the grab causing the other character to be unpinned within an OnCollisionEnter event which causes a prop drop. And somewhere in the mix, Unity doesn't like those DestroyImmediate calls.

    Thanks
    Allan
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    hi!
    It's just Unity's physics going nuts because of too much tension in the joints. Try increasing the solver iteration count in PuppetMaster and mass of the hand rigidbodies.

    Hi!
    Cant see those errors in my Grab demo for some reason..
    If you move the code that calls SetState out of OnCollisionEnter, for example to a LateUpdate, does it stop these errors?
     
  41. hmx_manrad

    hmx_manrad

    Joined:
    Jan 10, 2014
    Posts:
    8
    Hi,

    I have both FinalIK and PuppetMaster and am interested in making a FABRIK controlled tentacle that uses puppet master to add physics on top. I've tried taking the stock FABRIK demo scene, adding configurable joints to each link, and then configuring PuppetMaster, but can't seem to get anything that works right. Do you expect this kind of setup to be possible? Any pointers?

    thanks!

    Mike

     
  42. hmx_manrad

    hmx_manrad

    Joined:
    Jan 10, 2014
    Posts:
    8
    figured it out - its working great! Had some parenting of the rigid bodies that was causing issues
     
    Partel-Lang likes this.
  43. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Partel,

    Back in November 2016 you said the following:
    Thanks for the feedback. Unfortunately I was unable to get Immunity to work by setting it to a value of 1 or greater for all muscles in the update loop. It took me most of a morning to figure out why. In BehaviuorPuppet.cs, using a foreach loop, you apply Boosting Falloff to every muscle using MoveTowards. By default I had Boost Falloff set to 1 in the inspector of my Behavior Puppet. So your MoveTowards was counteracting my changes in the update loop. I fixed it by setting Boost Falloff to 0 but that leads me to a performance improvement request.

    I would love to see a public bool (UseBoosting) in the BehaviorPuppet inspector that lets me turn off that foreach loop that uses MoveTowards on Immunity and Lerp on ImpulseMlp. That way I could just set my immunity and impulseMlp in OnStateEnter and OnStateExit in my StateMachine Behaviors without having to apply them in every update loop. Not too mention there would no need to run through that foreach loop if I'm not actually going to use your implementation of Boosting.

    Edit: I thought I had it fixed. I commented out the Boosting Falloff foreach loop you use in BehaviourPuppet but I'm still getting damage.

    I've placed the following in an update loop and tried it in the fixedupdate loop in my character controller.
    Code (CSharp):
    1. for (int i = 0; i < puppetMaster.muscles.Length; i++)
    2.             {
    3.                 puppetMaster.muscles[i].state.immunity = 1f;
    4.                 Debug.Log("UpdateLoop" + puppetMaster.muscles[i].state.immunity);
    5.             }
    But no matter what I do, I still am seeing damage being applied in BehaviourPuppetDamage in the UnPinMuscle method. You must be setting Immunity back so 0 somewhere even as I make the changes in update.
    Code (CSharp):
    1. if (puppetMaster.muscles[muscleIndex].state.immunity >= 1f) return;
    2.             Debug.Log("Damage" + puppetMaster.muscles[muscleIndex].state.immunity);

    Thanks
    Allan
     
    Last edited: Jan 6, 2017
    Nutue likes this.
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey,
    I searched my solution for "immunity = " to see when it is forced and so BehaviourPuppet/PuppetMaster does set it to 0 for all muscles in these cases:

    - PuppetMaster is deactivated
    - puppet loses balance or is unpinned via SetState(BehaviourPuppet.State.Unpinned)
    - PuppetMaster.state is set to Dead or Frozen

    I added a bool hasBoosted to declaration space and that is set true if any of the methods in BehaviourPuppetBoosting.cs get called. If you do not call them, state.immunity will not be touched by BehaviourPuppet/PuppetMaster anymore.

    PM me if you need that stuff ASAP.

    Thanks for helping me improve the product! :)
    Cheers,
    Pärtel
     
    Nutue likes this.
  45. LudiKha

    LudiKha

    Joined:
    Feb 15, 2014
    Posts:
    140
    Did you already upload this somewhere?

    Oh and I tried out the Biped Balance FBBIK Behaviour - are the feet not supposed to be doing anything in that build?
     
  46. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    Hey,
    It required so many changes to the PM scripts I though it would be easier to just add it to the next version. If you are in a hurry, PM me your invoice number and I'll send you the latest right away.

    The BipedBalanceFBBIK does not do anything with the feet and it will be removed altogether from the next version, as I now have a superior solution for balancing and staggering.

    Cheers,
    Pärtel
     
  47. LudiKha

    LudiKha

    Joined:
    Feb 15, 2014
    Posts:
    140
    Cheers! Just sent you a PM.

    Considering you've made some progress on VRIK - any new insights as to when you're going to be able to continue development on this?
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,552
    I have both FIK and PM in the same project as I develop them so they are both developed continuously and in sync. What I focus on for each update depends mostly on the feedback I get from you guys.

    Cheers,
    Pärtel
     
  49. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    @Partel-Lang
    I'm having difficulty getting both varied and decent looking death sequences on impact (melee combat perhaps makes this more difficult).

    I think the real problem is that there are a half million parameters and values all of which affect one another (especially when also using the behaviourpuppet - which perhaps is something I shouldn't be doing).

    The examples use a huge range of values and setups. Behaviour puppet has 3 levels of muscle overrides and defaults.

    The total mass of the puppets themselves even vary from example to example, making the relationships between each of the values unclear.

    Do you have a suggestion for a 'stock' set of values including impact force and unpin that should work in a variety of settings using the stock puppet mass?

    I can then work on assuring my combat impacts work within a reasonable range.

    ________________

    Also, it seems that puppetbehaviour doesn't apply the unpins by kinship doesn't chain the unpin amount of connected kin?

    So like - Head unpin = 1, chest unpin = .5

    Feet get unpin = 1 on head impact despite going through chest at .5 (minus a flat rate per node in hierarchy)? shouldn't the relationships be multiplied through each node using the overridden unpin values at each node?

    edit: actually feet would be unpin = 1, since there isn't a flat rate - you just pow the value by the distance, so if unpin = 1 - everything in the hierarchy gets unpinned at 1 regardless of kinship distance (?).
     
    Last edited: Jan 18, 2017
  50. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Hello Partel-Lang,

    If pinning = 0, should the character completely ignore animations that are played on it, and just be completely physically based? Because with my characters, it seems to sometimes ignore them, and sometimes play an odd, ragdoll version of them where they're lying on the ground but still moving their limbs around.