Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. 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.

Bug LookAtConstraint rotation affected by worldUpObject's position and not rotation?

Discussion in 'Animation' started by daniel_lochner, Dec 16, 2021.

  1. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    175
    Hi there,

    I've assigned a transform to the
    worldUpObject
    field of a
    LookAtConstraint
    component as shown below:
    upload_2021-12-16_18-18-44.png

    Why is it that changing the position the
    worldUpObject
    in relation to the object on which this constraint is attached, affects its rotation? Should it not just depend on the rotation of the
    worldUpObject
    ? Rotating the
    worldUpObject
    actually doesn't seem to affect the rotation at all, so am I misunderstanding something?

    Thanks,
    Daniel
     
    Last edited: Dec 17, 2021
  2. SVAFnemesis_

    SVAFnemesis_

    Joined:
    Jul 15, 2020
    Posts:
    21
    "World Up Object" really means "Y Up Object". They put in the wrong name here.
    Y Up Object defines where constrained object's y axis is pointing towards after constrained object's Z axis has locked to the "source". And because of that, Y Up Object's rotation has no effect, only position in relation to the constrained object matters.
     
  3. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    175
    Thanks for your response @SVAFnemesis_! :)

    From my understanding, the
    worldUpObject
    used for the
    LookAtConstraint
    is similar to the
    worldUp
    used in the
    LookAt
    method of the
    Transform
    component.

    Yes, I agree that is how it should work. The documentation for LookAt describes it like this: "Then it rotates the transform to point its up direction vector in the direction hinted at by the worldUp vector. If you leave out the worldUp parameter, the function will use the world y axis."

    Not quite sure why this would imply the
    worldUpObject
    rotation not to have an effect on the source's rotation though? The
    LookAt
    works as expected, where the the position doesn't affect it at all.
     
  4. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    175