# (Solved!) Detecting angle movement?

In my game, I want to detect when a vehicle is flipping/spinning(side view), like in a bike stunt game, so a message will appear based on it. While I was partly able to, I doubt it is correct. The available event just simply detects what angle it is currently at, rather than the motion of doing so, like as in spinning in that direction, rather than just pointing in that direction. The other events I could find are more about the speed/velocity.

Hopefully, that was understandable.

As usual, I will continue to work on it in case I missed something.

You could store the value of the angle for an object into an object variable, making sure this is the last event in your event sheet. Call it “previousAngle” or something. Then, in an event after you update the objects angle you can do previousAngle - Angle on the object to get how much the angle has changed by

Are you using the Physics engine? Then Angular Velocity may be what you’re after.

MrMen: Yes, I am and I was just testing with that.

Edit: Though I have made improvements, seems one of the problems I’m coming across is it will also count the angle that it started with, like driving up or jumping off a slope. Need a way to change where 0 degrees starts when starting the flip or something else. Such as detecting how many degrees it has moved. Will continue working on it. Gonna try Loxon’s idea.

Wonder if there is a way to add or subtract 1 to a variable for each angle degree moved?

Luxon5, I don’t know how to compare the two values for getting how much it has changed and react if over a certain amount.

I’ve been trying to use the Compare Two Numbers with the Difference Between Two Angles, but it doesn’t work. You’d think that is the trick. Am I using it wrong? Tried different ways to, with the last one using 1 object that follows the main object’s angle and stops at that angle when I start the ‘stunt’ and then compares the two angles. Am I missing something to make it work? When does the event check the angles? Will it activate once it reaches that angle or is it not constantly checking?

I am really racking my brain on this problem and I am determined to make it work.

Have you tried getting the angle to a positive value by adding 360 to it, and then using modulo 360 on that result - so it’s `angle = mod(Angle + 360, 360)`.

However, if there’s a chance that the angle can be less than -360, then maybe change it to `angle = mod(mod(Angle, 360) + 360, 360)`.

Sorry, I don’t understand that level of math, but still tried it anyways.

Out of curiosity, I had an on screen text show the angle difference. It does work, but like you said, it can show negatives. As suspected, counter-clockwise shows negative and clock wise shows positive.

All modulo does is divide the first value by the second value and return the remainder.

Well, that works to keep current and previous angle positive, but not the angle difference.

How come I am not getting anything from AngleDifference?

I have text being set to show the Difference, Rotation Speed, Previous and Current Angle. Three of those show changing numbers, but difference always stays 0.

Edit: Nvm, I got it working! After a quick little math research, I found to just subtract the two variables instead, then used mod to make it positive! (Scratch that, I can add messages for negative spins.)
Huzah!
Thanks to both of you for the help.