Simplest pathfinding around a tilemap track

Just started using Construct 2? Post your questions here

Post » Thu Jan 07, 2016 11:21 am

LittleStain wrote:Most of the math in that example is to prevent the overlapping..
All you'd need is the part that does the bullet instead of the follow path..

Like this:
https://dl.dropboxusercontent.com/u/485 ... rcles.capx

This is perfect! Thank you so much, a lot easier to read for those of us who are a little lacking in geo/trigan-ometrical knowledge :D I noticed the pathfinding method was a little shaky when the screen is set to scroll to it, I'll be keen to see if the bullet smooths things out. Is bullet a better behavior to use over, say, the car behavior?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Thu Jan 07, 2016 11:44 am

Zebbi wrote:
LittleStain wrote:Most of the math in that example is to prevent the overlapping..
All you'd need is the part that does the bullet instead of the follow path..

Like this:
https://dl.dropboxusercontent.com/u/485 ... rcles.capx

This is perfect! Thank you so much, a lot easier to read for those of us who are a little lacking in geo/trigan-ometrical knowledge :D I noticed the pathfinding method was a little shaky when the screen is set to scroll to it, I'll be keen to see if the bullet smooths things out. Is bullet a better behavior to use over, say, the car behavior?


You are free to try and make this with the car behaviour..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 07, 2016 3:38 pm

LittleStain wrote:
Zebbi wrote:
LittleStain wrote:Most of the math in that example is to prevent the overlapping..
All you'd need is the part that does the bullet instead of the follow path..

Like this:
https://dl.dropboxusercontent.com/u/485 ... rcles.capx

This is perfect! Thank you so much, a lot easier to read for those of us who are a little lacking in geo/trigan-ometrical knowledge :D I noticed the pathfinding method was a little shaky when the screen is set to scroll to it, I'll be keen to see if the bullet smooths things out. Is bullet a better behavior to use over, say, the car behavior?


You are free to try and make this with the car behaviour..


Tried applying your example to mine and the sprite just tries to go backwards for some odd reason: https://www.dropbox.com/s/tddz3vzcet8ya25/try.capx?dl=0
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Thu Jan 07, 2016 3:44 pm

Sorry, can't open that capx, because it uses magicam-plugin..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 07, 2016 4:38 pm

LittleStain wrote:Sorry, can't open that capx, because it uses magicam-plugin..

Sorry, forgot about that, here's a new one: https://www.dropbox.com/s/1fjgkpdpnv9o9 ... .capx?dl=0
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Thu Jan 07, 2016 5:51 pm

I don't see any odd reason..
Pathfinding finds the shortest path, so if you don't close off the direction to the finish it will go directly to it..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 07, 2016 10:14 pm

LittleStain wrote:I don't see any odd reason..
Pathfinding finds the shortest path, so if you don't close off the direction to the finish it will go directly to it..

I'm going to work with your bullet idea, but I tried working it into using the pathfinding motion (since I liked the little rotations on the corners) but the sprite AI has a little think before it goes around again (kinda cute) whereas a fluid continuation would be better, not sure I can do that though? https://www.dropbox.com/s/sxwl936plk26u ... .capx?dl=0
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Fri Jan 08, 2016 12:02 am

LittleStain wrote:I don't see any odd reason..
Pathfinding finds the shortest path, so if you don't close off the direction to the finish it will go directly to it..

@littlestain perhaps the easier question would be, is it possible to interpolate the angles of rotation? at the moment with the bullet movement, the sprite just jumps to the angle it's going, whereas with pathfinding it smoothly changes the angle. Perhaps with lerp?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Fri Jan 08, 2016 1:09 am

I wouldn't use lerp (or anglelerp in this case), but if you want to try, go ahead..
Maybe you could use rotate counterclockwise while within a certain distance of the node untill the right angle is reached..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jan 08, 2016 6:36 am

LittleStain wrote:I wouldn't use lerp (or anglelerp in this case), but if you want to try, go ahead..
Maybe you could use rotate counterclockwise while within a certain distance of the node untill the right angle is reached..

That's what I was thinking, maybe something like
anglelerp(Self.Angle,TargetAngle,8*dt)
but I'm not sure how to use this in a condition with the current system?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

PreviousNext

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests