[SOLVED] How to check angle of movement with forces? Not angle of object

I am trying to move many objects to X and Y position of where mouse cursor was when LMB was clicked
To set proper animation to them (actually only flip animation horizontally or not)
Problem is that i fail to do it for red area while green area works perfectly fine
image

I am moving units with forces to said position

But im checking angle of movement with forces

I think if i could see what is angle of movement of units or at least 1 unit which i could set to text object would tell me what is happening and what i am doing wrong
Tolerance is now set to 180 degree but even when it was 90 degree same thing happens

LMB to drag selection box
RMB to move selected units
LMB to remove selection clicking anywhere on grass

If you make move units to the left and then try to move them to the right in angle 0 to -90 which is right to top area or just use image of circle from above to understand what angle area i’m talking about
Then animation won’t flip from left to right

IDK if this is still an issue but for you or others… the issue is the way the rotation is figured. zero is right and it goes clockwise to 360. So, right would be 0 to 90 and 270 to 360. The left side on the other hand goes from 90 to 270. So, you can use 180 degrees with a tolerance of 180 degrees. You can then use the inverted version for the right side.

Something like:

1 Like

And it works like a charm this fixed the issue

Bless you

But that does not answer my question
How to check angle of movement of object?
If i could see that value i would figure that fix myself
Since angle of objects go from right to left going top from -0 to -180
And from left to right going bottom 180 to 0
And from that my confusion comes

I couldn’t find a matching expression. The angle system varies depending on the expression or condition. Sometimes its 0-360 sometimes,0-180 and -180 to 0. I just used trial and error.

When I test a condition to see if the action is being triggered, I’ll sometimes use a play sound action for feedback.

1 Like

As far as i can tell it is like this top from left to right -0 to 180 bottom from right to left 180 to 0 for angle of object when you rotate it or angle between two objects
Since these i actually use in my test project and i am able to check them

But for angle of movement it is 0-360°
According to what you told me
But since i can’t check it can’t confirm that

Good idea with sound i jut go with flipping image of some object or tinting it

Well whatever thx for your help it solved my actual problem
But still waiting for some way to check angle of movement

1 Like

You can use ranges of angles and based on that, assign a variable and thus modify the animation.

In case the object works with 360 degrees instead of 180/-180, you can use this expression:


I have discussed it in this post:

On the other hand, it should work more easily with “angle of movement”.

1 Like

Keith already solved my problem but THX
I was expecting expression i could use to print angle of movement to text object to see what is actually going on
I did not even take into account to simply put some range and check what angle it will work with when moving object
Which would tell me exact values i needed to know

I again fall under answer was to obvious for me to figure it out on my own

If it’s solved then please update the title to include some form of [solved] :wink:

1 Like

My bad
Updating it thx

1 Like

I totally forgot about it since i seen it only when i started using gdevelop
But this
https://wiki.gdevelop.io/gdevelop5/all-features/common-conversions/#angle-conversion
Is kinda helpful
Especially this picture
pres_coord2
Which explain why flipping animation horizontally (to the left) did work but did not for right for upper right corner (looking at picture above from 270° to 0°)
I believe what was happening is
When on left i had 180° with 180° tolerance it was reading 180° with 90° each way so it was range from 90° to 270° (looking at direction of arrows on circle)
And when i had for right animation flip so no horizontal flipping 0° with 180° tolerance
It was reading 0° to 90° and 0° to -90° and that’s why upper right part was not detecting anything
I should go with 315° with 90° tolerance + 45° with 90° tolerance and that would cover whole right side
So i would need to set two conditions with OR statement (if one of these conditions is true)
And add that two ranges and it would work perfectly fine
Yet Keith solution is ultra more simple since it checks if movement happens in left side angle and simply inverting it means movement angle is done in anything but left side so right side and that actually works just fine

That is just a tip for any1 who would need that kind of angle check of movement that below 0 it goes to negative and AS I AM ASSUMING angle of movement checks for 360° not 0° to 180° and -180° to -0° (where angle of objects work on that two ranges 0° 180° and negatives)