# Rotation of the pathfinding objects In correlation with animation rotation

rotation of the pathfinding objects In correlation with animation rotation
I have it working it’s just seems more than I would want it to be

“can i rotate pathfinder better ?
can i animate the player better ?
self blocking cows not working but i can maybe fix that”

Video Below
Twitch Video

Can you detail how you are getting the cow’s pathfinding?

just divide by 90 instead of 45

it is why would i divide by 45 ?

the problem is i want to use one object.
I have seen other peoples way of trying to do it but they kinda slide around.

Entropy:“it’s a pathfinding object that walks up and down left to right no diagonals and is animated with an idle state
I’m pretty sure it’s impossible to do with one object
The cows also have to pathfind around each other
But for that you would need object IDs or using the linking system
Having it two objects does simplify the cow’s path finding around each other and blocking each other
It just seemed like a for one animal because I’m going to be adding a few of them”

“Leo Red: Does your pathfinding object have “rotate the object when turning” truned on?”

Entropy:“If you allow rotation in the behavior it will mess up all the animations because your whole object is rotating
That would rotate the cow in its spot
The cows walk up and down left to right”

Leo Red: “@Entropy Hey, I found a way using only one object. It is not the best way. But, works”

Entropy: “That would be two scene variables per animal
Does she slide around in animation I’ve seen other examples and that’s what happens
You might not be able to tell with that type of top-down view art
Because that’s in an isometric perspective or tilted angle art”

I’m sorry i should of been more clear on my questions i was nervous.

it seem you have not checked out the image.
you dont need any variables, you just check math and set animation:

at the end of the formula you divide by 90 not 45, because you only have 4 directions.
the conditions are the same, in actions replace the 8+ with 4+
and the /45 with /90 and ure good to go.

this formula, as you can see, does not work with the angles of the object, only the pathfinding notes. so it works with rotation disabled.

E: this is, assuming your animation number 0 is idle:

same works for the cows.

idk exactly what you mean with selfblocking cows, but you can give the cows a pathfinding obstacle behavior and set them to impassible.

I’m sorry i was really tired my brain was not working i added the arc tangent comparing.

But unsure of the order of animations for walk and idle i tried to make directions work at the least but that didn’t fully work I know it says +1 and +5 for 0 < and >0
but my number of animations are not quite like it seems like there would be one animation for idle state
that but my brain is still not working iv been working on different projects and helping.

https://puu.sh/GMW1k/55c25e12d3.gif

Here is the code in plain text:
round(ToDeg(atan2(Cow.Pathfinding::NextNodeY()-Cow.Y(),Cow.Pathfinding::NextNodeX()-Cow.X()))) < 0

5+round(ToDeg(atan2(Cow.Pathfinding::NextNodeY()-Cow.Y(),Cow.Pathfinding::NextNodeX()-Cow.X())))/90

round(ToDeg(atan2(Cow.Pathfinding::NextNodeY()-Cow.Y(),Cow.Pathfinding::NextNodeX()-Cow.X()))) ≥ 0

1+round(ToDeg(atan2(Cow.Pathfinding::NextNodeY()-Cow.Y(),Cow.Pathfinding::NextNodeX()-Cow.X())))/90

the problem is the order of you animations.
it goes like this.
anim 0 = right
anim 1 = down
anim 2 = left
anim 3 = up
Clockwise Animations, because Math
keep that order for all animations.

then you have not 1 idle anim, but 4, so you need +4 instead of +1
means 4+round( and 8+round(

as for your idle animations, you could make a subevent with variables to determine the direction and set the animation with that variable.

heres what i do:
I enable rotation of the pathfinders. so that i can work with the angles, instead of needing variables. saves some memory. and i need the angles for more then just animations anyway. changing the animations is actually very easy and fast.
Inside Piskel, Hold shift and click on rotate till your frames look to the right.

1 Like

I did what you said here’s how it looks
they are sliding around and ignoring directions

have you disabled diagonals?

Thank you so much for trying to help me i appreciate it
I’m going to look for a different engine for this project

i think the problems are minor and easy to fix.
you will face other problems with other engines too.
I reccomend not giving up so easely.

have a look at the pathfinding behavior of the cows.
what numbers do you use for ther grid? (cell height/with?)

i see the problem might be the timer. you need to guarantee first, that they only move straight lines, aka stay in ther 64x64 grid. means they should only start to change the directions, once they reached ther destination.

I already had a problem with the lighting layer not hiding the ambient light color and not being able to change the ambient light color in events or js i had to use the dark night effect and no dynamic lights im done fighting the engine with this project

i see. good luck for future projects.

1 Like

in the original video they are moving in only straight lines with no animation or sliding issues it was just i did not want to use two objects

you dont need 2 objects.

if you upload your file, i can have a look if you want.

I get that but i was still having all the same issues i had before trying to use one object

You might have to see why it is happening and try to filter it out or make a formula to make it work.

I forgot to say i sent it to you

Hey, I found a example from the pathfinding wiki. I don’t know how it is working. Maybe, because it might have been made on GD4. It might help. I work without a problem.GDevelop 5