• News

• Industries

• Learning & Support

• Community

• Marketplace

How can I detect when player camera does a full 360° yaw rotation in the air?

When my first person player jumps in the air, I want to award points based on how many full camera turns the player does before landing (by moving their mouse/joystick). I want this to work in either direction, so you can do the 360 clockwise or anticlockwise, and I want the amount of full rotations to be stored in a variable.

The furthest I’ve gotten is setting an initial yaw angle variable when the player first jumps, but I can’t wrap my head around the math to find if the yaw of the player in the air is a full 360 degrees from the initial angle. How would I do this?

If I could get some pointers, that’d be great. thanks all.

Can you please show me how do you handle rotation input?
Also, remember that PC players with gaming mice can easily abuse this mechanic by simply creating a macro that will increase sensitivity. In case of very high sensitivity player can not only get too many points but also, if there will be more than one rotation per frame many turns can be not counted.

1. Get the Yaw at the initial jump. You’ll need to calculate the offset it converts to 0.
2. Get in what direction the player is rotationg (this will be locked until char lands)
3. Get Yaw each frame and Apply same offset and store on another variable only if value is greater than previous (so player can “wiggle” and wont blow up the entire thing.
4. When this second variable > 359.9, ++ the int where you store rotation count and reset yaw to 0.

Something along those lines.

I’m not too worried about players cheating, it’s a single player game and the points are just for fun, they don’t contribute to the gameplay too much – if the player wants to cheat, then so be it

Let me visualize what I’m trying to do and what I’ve tried:

This is how I’m handling input, just a simple add controller yaw/pitch.

When the player jumps, and does a full rotation in the air before landing (example in video), they get a point (or something else, it doesn’t really matter right now). Eventually I’ll do a check so the player can only do this if their velocity is high enough.