Search Unity

How to assign a rotation relative to another object?

Discussion in 'Scripting' started by Trild123787898, Mar 23, 2019.

  1. Trild123787898

    Trild123787898

    Joined:
    Dec 9, 2018
    Posts:
    206
    There are Projects A and B. Is it possible to assign a rotation to an object (A) relative to one of the sub-project objects (B) without using SetParent help me What to do, what to look for?
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    You can use InverseTransformDirection to convert a direction vector from A's world space to the B's local space. Is that what you mean?
     
    SparrowGS likes this.
  3. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Was just gonna say this, use object b transform.InverseTransformDirection and assign given vector to object a.
     
    GroZZleR likes this.