Question by
HussamKADDB · Apr 07 at 03:45 AM ·
rotationrotate objectrotation axis
,rotate object to match another object on its local 3 axis
, Hello
I am trying to make rotation for object in the image , the gizmos are showing both objects local rotation. I need to match the metal plate rotation to the point near it on its local three axis.
I used this code
targetObject.rotation = Quaternion.LookRotation(transform.right, transform.forward);
but the metal plate forward will match the point right direction and the plate up direction will match the point forward direction, and that what i want . however i can't find a way to let the plate X axis match the point negative Y axis.
rotation-question.jpg
(81.6 kB)
Comment
Best Answer
Answer by HussamKADDB · Apr 07 at 07:50 AM
i don't know where my brain was when i asked the question . i just needed to multiply right vector with -1 to get my correct rotation
targetObject.rotation = Quaternion.LookRotation(transform.right *-1, transform.forward);