Gimbal Set Up

I was unsure if we used cube object in the set up for the body rotate. So I am going to try 1 empty object for the Camera Gimbal this will rotate in Y axis. Parent the camera to it. The camera will have X rotation up and down.

@Homzie No need for a cube for the player gimbal setup. Simply use an empty object as the player for Y rotation and make the camera a child of the player empty object for the X rotation

You can revisit this and create a boxy, avatar-like representation of a basketball player with cubes if you like. Just add legs, feet, torso, etc. and colors and/or materials for team colors, etc., but the VR user won’t really see much of it.

1 Like

Thank you for the feed back, it is much appreciated.

I am doing the same thing: create an empty game object, and make it a parent of the camera. Rotating around the Y axis happens in the parent, and rotating along the X axis happens only in the camera. I’m trying to figure out how to accomplish both in the same script, but I’m sure the video will reveal this.

Up to the pause point in the video it wasn’t explained how to access the parent in the script. So I googled it, bent on figuring it out on my own.

This is the code I came up with to solve the challenge:

  transform.rotation = transform.rotation * Quaternion.Euler(mouseY,0,0);
  this.transform.parent.rotation = this.transform.parent.rotation * Quaternion.Euler(0,mouseX,0);

this.transform.parent.rotation - is a pointer to the rotation values of the parent for the current object (the one running the script, the camera). So changing it’s rotateY values will make the parent turn left right. The camera being a child of the parent inherits that transformation.

1 Like

Privacy & Terms