Search Unity

Question How to move and rotate child collider transform without violating physics?

Discussion in 'Physics' started by unity_2jxHNVY36zr2mg, Jun 28, 2020.

  1. unity_2jxHNVY36zr2mg

    unity_2jxHNVY36zr2mg

    Joined:
    Jan 17, 2020
    Posts:
    86
    I have a non-kinematic rigidbody with a several bones and attached child collders.
    It is made to bend the body (like a snake) and keep collisions.
    This doesn't work well with physics engine, since i am moving/rotating bone transform from code (eg bone.Rotation=, bone.Position=). Some collisions cause jerking and jumping away.
    Any idea how to make it propererly ?
     

    Attached Files:

  2. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    868
    Hey, the "correct" way would be to have a rigidbody for each bone and use Joints between the rigidbodies. You can then control rotating with the joint drives. A small warning: If you have not used joints before, prepare ourself for some days of reading and trying out, as this is not trivial to setup.
     
    unity_2jxHNVY36zr2mg likes this.