Rotation Issues (145066)

Hey guys / gals.

I’m really getting frustrated. I know this is something that has got to be simple.
But I just can’t seem to knock it out.

Everything works fine when I’m on a FLAT surface. But the second I try to rotate my vehicle turret, (Either with Mouse Look, or even doing local AND world rotations AND EulersAngles AND Angles, it just doesn’t follow the parents rotation).

can you please guide me on what I need to do?
The ones I do get to work, force it to work, yes that’s good, but then I can’t rotate it on my own, they stay zeroed out permanently and can’t rotate it.

(I am trying to get that turret on top of the vehicle to rotate 360 degrees VIA Mouse Get Axis (Mouse X).)

Let me mentions this as well. If I keep the Camera 100% centered it stays perfectly fine, the angle matches perfectly.
It’s just when I start to rotate the turret in the photo.

I’ve been searching for hours non-stop, and can’t seem to figure this out at all.

Can you PLEASEEEE help me? Thank you!

1 Answer

1

float speed = 10f;
void Update(){
transform.Rotate(new Vector3(0, -Input.GetAxis(“Mouse X”), 0) * speed);
}

Nope still don't work. Well I just realized something, (this is an online game). And just realized before player spawns (I look at it inside the inspector with the script on, and it works) but as soon as player spawns thats when it messes up. So wow, can't believe this whole time it was working, but something interfering with it. I will mark this as correct because it clearly is correct. Just something else is interfering with it. Sorry for bothering you! I knew it should have worked before because I've done this a few times in the past and never had an issue with it. But, thanks buddy!

I believe I found the culprit. It was getting another script that was locking it's rotation back down, I guess an old script I forgot to delete. Wow lol. But THANKS AGAIN BUDDY!