How would I make a combine turret from hl2

How would i make an turret system simillar to HL2’s Turret.
What im mainly trying to acomplish is how it aims at the person, all the bullet stuff i know how to do.

Here is a example:

Another example


image

Basically im just trying to recreate the aiming system, and how it has a max angle on where it can turn, and where it cant, for both parts.

Are you able to get it to aim (without limits) first? The angle limiting is surprisingly complicated math.

Yeah, im able to make the base of the turret move with limits and everything, it was pretty easy.
Now im confused and i have 0 idea on how to move the turret gun itself, while having it be on the same position as the already moving turret base.

To move it ima have to do something with orientation, for the turret gun, since i cant do cframe since that ruins the weldconstraint really, (or not, im not so sure).

Aiming:

Angle:

Hmmm. Have you tried AngularVelocity instead of constantly updating the CFrame? Constantly updating the CFrame will make the turret look choppy when it looks at an enemy. AngularVelocity will cause it to rotate smoother, and I believe it does not interfere with welds.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.