Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question Fun with Joints..

Discussion in 'Physics for ECS' started by MidnightCow, Apr 11, 2023.

  1. MidnightCow


    Jun 2, 2017
    Okay i figured i should make a post for this as i'd love to finally try and solve it..

    [This was originally tagged Havok but it's not - it is Unity.Physics - fixed]

    So i have some active ragdolls, and i'm driving rotation with anim data inside an iSystem..

    My hacky workaround is using PhysicsVelocity.CalculateVelocityToTarget and setting velocity directly which works but the ragdolls obviously don't respond well to collisions ( i have to manually detect collisions and lerp the 'strength' of this velocity based on the ragdoll being hit by something )..

    So i'm trying again to drive joint constraints directly.. The setup i'm trying out is as follows, three simple angular constraints on the joint, one for each rot axis ( and another joint with fixed linear position to hold the joints together )..

    So i'm using the anim data ( which is actually the transform.localEulerAngles of the source anim rig ) to drive the Min/Max values directly..

    This seems to work as shown in the following clip but as seen rotations aren't following exactly ( lower leg and feet ) and i think this is probably something to do with the math behind quaternions/euler/rotation-order etc etc.. Maybe using three angular constraints like this isn't ever going to produce the correct rotations, i have no idea as i don't know how it works under the hood or the maths involved..

    It's been suggested to me maybe i'll have to use 3 joints to achieve this with some kind of ball and socket setup in order to drive all three axis like this, but any help/advice would be appreciated as i really don't know what i should be trying, i've tried various configurations up until now.

    Last edited: Apr 12, 2023
  2. MidnightCow


    Jun 2, 2017
    For reference:

    My source animation is just getting stored to a blob like this:

    And the values are being applied to the joint constraints like this: