Clamping a turret rotation

I am creating a game in which the turret needs to rotate 180 degrees. As of now, it rotates 360 degrees below ground. I attached the barrel to the sphere and just rotated the sphere to the effect i was looking for. Im using the player controller for my elevation control blueprint. This seems so ■■■■ simple but yet I’m stuck, please help. Im still learning but im a bit farther than beginner but still please dumb down any answers for me lol.


CanonInPlace

Have a look:

1 Like

I saw that thread but could not figure out where all this code goes. Does this go in the canon as opposed to the game controller? Do i attach one of the nodes in this code to my existing code? Is there anyone that could explain why this works instead of a simple clamp?

where all this code goes.

In that case in the cannon since there were multiple.

In your case, you can:

or even like so with no variables:


There is a chance I do not fully understand the ask.

Perhaps this is what you’re after:

You could try:

image

If 180 is what you’re after, that’s the most minimalistic I can think of.


And this maybe, too:

Do tell if that helps at all. There’s probably half a dozen other ways, too.

That is exactly what im after! I know i may seem like an idiot for getting stuck on something so simple but jesus this is racking my brain. Ok so essentially I want the barrel to rotate 180 degrees and not go into the ground. I tried the options above and still cannot get it to work. I am coding everything into the player controller, is that where im messing up? Essentially, i have set it up so that A and D move the barrel. The barrel is a child of the sphere so that I can rotate the sphere and the barrel moves with it. Please let me know if you need more info

Ok so the most simplistic “Add Pitch Input” worked. I had to adjust the rotation of my canon to get the result i wanted but it worked! I still would like to figure out the other methods as well and maybe learn what I was doing wrong if anyone has the patience to help me understand lol. Also, sorry for the grammar mistakes, I usually type better but my brain in fried lol