Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Lightbulbs's avatar
Lightbulbs
Honored Guest
11 years ago

Use parent objects rotation without Follow Orientation

I have a question regarding "Follow Orientation".


How do I get the rotation of a parent object and apply it to my OVRCameras (using the OVRCameraController.prefab) without using Follow Orientation?

The game object with OVRCameraController.cs attached (in the prefab OVR Camera Controller) correctly rotates when attached to a different parent object but the left and right cameras do not. If I drag the parents transform into the Follow Orientation field everything works properly, but because the characters are clones, I do not want to have to drag and drop the transform every time I switch players.

The OVRCameraController is being instantiated one time and when an instantiated character is selected, it attaches to that character as a child.

This is the hierarchy after a character is selected:

Character1(clone)
--OVRCameraController
Character2(clone)
Character3(clone)

Now, if the rotation of character1 is 0, it attaches with the correct facing direction. If I select Character2 (who has a rotation of 180), the OVRCameraController properly switches its parent and position but does not rotate the cameras. The OVRCameraController is rotated 180 but the left and right cameras are still 0. Now the hierarchy looks like this:

Character1(clone)
Character2(clone)
--OVRCameraController
Character3(clone)

I am probably making this far more complicated than it really is but I absolutely need help.

Thank you for reading!

1 Reply

Replies have been turned off for this discussion
  • You should be able to switch the "FollowOrientation" parameter programmatically at the same time you switch players.