Attempting to make a movable car turret

I’ve been attempting to create a vehicle with a mounted turret, and I haven’t had the best luck so far. This is the first time I’ve tried to do this before, so bare with me.

Below is the vehicle and the gun I’ve mounted onto it:

My goal was to make the turret be able to move 360 degrees so it could fire from any direction. I also wanted it so be able to move up and down a little. The closest I got was with a pretty complex albeit flawed method.

In short, the gun is welded to the rest of the car via one part and one weld. When the player would enter the gunner seat, the weld would reattach from the gun to the car, to the gun to the player’s character (and switch back once the player exited the seat).
The reason I did this was because I implemented a script which would move the gunner seats’ orientation whenever you used the A/D keys, and welding the gun to the player’s character meant the gun would move with the seat, which seemed perfect at first. I later made it move up and down too.

However, something I feel like i should’ve realized earlier is that this doesn’t work if the car isn’t on flat ground. When the car is tilted a bit up on some rubble, the gun will move at a weird angle through the car. The less flat the car is the weirder the rotation gets.

Gun facing backwards at max height normally:

Gun facing backwards at max height when ran up against some rubble:

This method also came with some unexpected, but solvable if not at least negligible issues.

So, my question is; How would I go about making this turret consistently rotatable? I don’t think theres any way to fix my current method, but I don’t really know of any others, and I can’t find any tutorials on this specific topic.

1 Like