Don't let actor have go higher or lower than certain angles

owen_dennisowen_dennis Just a guy, you know.Member, PRO Posts: 236
edited April 2015 in Working with GS (Mac)

I have a gun actor that follows the player and when it follows it angles somewhat. It's a big gun thing that shoots a laser the opposite direction that the player is going (so the player can control it and it's more sluggish and heavy feeling than the player). I have it set up so that it's always using the vector to angle function to face away from the player and shoot, so it uses the player's location as the first point and calculates the angle between the player and itself, and that's the direction it shoots. Because my player moves much faster than the big gun does, it can end up making the big gun shoot in a direction that's almost 90 degrees upward, which is too far. Sometimes the player is even able to move all the way around the gun, which lets the gun shoot backwards, which I don't want. I want it to basically always face somewhat to the right.

What I would like to do is make it so it won't go further than 15 degrees upward or downward. So I'd like to constrain the gun from ever going above 15 or below what would be -15, but there is no minus 15. It goes straight to 345. Because it crosses that 0 line, I can't figure out what to do to make the gun stay within my range I want.

Are there some workarounds for this?

Sign In or Register to comment.