[Solved]Movement angle on link tools

Hello, how do I find the angle of something moving that uses link pathfinding movement? Thank you very much.

I think we’re going to need a little more info. The angle of an object, angle of movement or angle related to movement or position?

I’m also not sure what you mean by link pathfinding.

Heya Keith. I’m using link tools to find a path for my piece. The piece has link movement behavior. I want to change animations depending on his movement. Tyvm.

If an object is using the Pathfinder behavior you can use

It doesn’t look like the “link tools” behavior exposes that function. You could modify the extension (I haven’t looked at the code much, it uses JavaScript) or you ask the creator to add the expression.

You could calculate the angle using [AngleBetweenPostions] between the current position and the next nodes x,y

I tested this by turning off the rotate object option for the behavior. The only issue was the first time I moved it glitched and briefly turned backwards. It always seemed to be -135 for me. So, I added a check for that angle. There’s probably a better way to prevent the initial glitch.

The mover object in this example is the object with the behavior. The one the behavior moves.

Edit: I figured out why it “glitched” for me. My mover object was at 33,33 when the project started. The behavior moved the object to the starting position which is 32,32 before moving to the next node. Once I changed the default position of my mover object to 32,32, it didn’t “glitch”.

1 Like

Heya, thanks, you’re right the link tools does not expose this option like the regular pathfinding, which is why I was asking here. The initial glitch like movement always happens if you don’t have your object correctly at a node. I’m already using next node calculations for my animation. It seemed to me like just a clunky workaround to do something i didn’t know how to do, but since you’re suggesting it too maybe it’s just as good. Thanks.

1 Like

I did mark this as closed since your answer gives me confidence that using next node is not a totally gauche thing for me to be doing, but just drop me a message if you think it will cause any performance issues. I have my pieces limited to no more than 30 at any given time. Thanks.

1 Like

If the function was exposed, it probably used the same function to calculate it. It should only have to he used once per node as long as the behavior shows some form of node index.

Edit: there’s an [at node] condition, even better. [is moving] and [is at node] then change the animation.