Question by
raghadalghonaim · Apr 28, 2020 at 01:40 PM ·
camerapositionunityeditororientationpose
How to get the object relative pose with respect to camera (position+rotation)
Hello,
My scene consists of a camera and an object tracked by the camera. I want to get the object's pose (position+rotation) with respect to the camera. I don't want to make the object a child of the camera as well.
I managed to do it for the position, but not orientation. Could someone please help me with this?
Here's how I did it for the position, please correct me if I'm wrong.
Vector3 relative = camera.transform.InverseTransformDirection(cube.transform.position);
I want now to get both relative quaternion and euler angles.
Comment