How can I stop a child game object from being affected by parent rotations

Hi, I’m messing around learning the Unity Engine and I had a small idea for riding this horse around…

I’m using Horse Animset Pro from the asset store which handles the mounting etc and I’ve incorporated SteamVR into my project as well. Everything is going well but I have an issue, when I mount the horse, it puts my play area as a child to the mount point on the horse which causes some extreme head bobbing when the horse is running etc.

Here is an example: Screen capture - e31c1e01f76d1fa778ca475406efe3fa - Gyazo


I’ve turned almost every link purple on trying to figure out how to lock the rotation of the play area I found some info on Quaternions but this is the most I’ve been able to accomplish: Screen capture - b0519ed01f30d7422c60ecbe3136c202 - Gyazo

Now my question is, how can I get it so the playarea Quaternion rotation can move around on the left/right axis but is frozen on the up down so that there’s not an extreme head bobbing effect…

Sorry to say, but above answer won’t work well as:

  1. It prevents any irregular rotation on x axis (yes, you could dynamicly modify headCam but it’s pain in the ass)

  2. You can’t directly alter parts of Vector3 properties.

Now, if I’m right in my assumtions, and you can edit the scripts provided with that packcage from Asset Store then you could alter it that instead of making you a child of a mount, it could add a Parent Constraint and if so, then your fix would be just one click on the “Freeze Rotation Axis : x” field.

Make a float variable and use it to assign the camera’s transform.localEulerAngles.x.

float headCam = 0;

//during gameplay.
yourCamera.transform.localEulerAngles.x = headCam;

You can now edit/animate the headCam value.