Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Rotate dummy parent applying physics of children.

Discussion in 'Physics' started by nporaMep, Oct 25, 2015.

  1. nporaMep

    nporaMep

    Joined:
    Oct 31, 2014
    Posts:
    33
    I have GO with Transform named "Pallet"
    It has multiple children GOs with RigidBodies and Colliders. They represent planks of the pallet.

    I want to rotate and move "Pallet", so that children rigidbodies apply physics.
    Rotating Pallet results in changes of both global position and rotation of plank.

    As I understand Unity's API now this should be done with RigidBody.MovePosition/MoveRotation on each plank.
    If I just set position/rotation of "Pallet" physics are not applied by planks as they are moved.

    What is the correct approach here?
    Should I rotate/move planks instead of Pallet? If so - how to convert Quaternion(rotation)/Vector3(translate) of a parent to child object?
     
  2. nporaMep

    nporaMep

    Joined:
    Oct 31, 2014
    Posts:
    33
    More specifically, plank is more like a roller, for now it is unity's cylinder that is rotated 270 degrees around Z axis so it doesn't stay on flat side, but roll.

    I have a desk under that rollers that is being rotated around Y.
    From that desk I receive its Quaternion.

    Then I need to rotate roller first by 270 degrees, then by desk's quaternion, then around local horizontal axis, so roller rolls.

    I tried like 20 methods, but didn't make it yet. Best thing I got now is rotate it by 270 degrees w/o physics and then by desk's quaternion with physics.
    Physics are applied by delta, I calculate it via deskQuaternion * Quaternion.Inverse(oldRotation)