Path Movement Behavior

New releases and general discussions.

Post » Thu Aug 12, 2010 4:25 pm

Looks like an awesome plugin rojo.

You seem to have covered pretty much all bases with this one.

My only "concern" (for lack of a better word) would be some things brough up on the first page of posts regarding path transitioning.

I was thinking of doing a bit of a PC remake of the PS3 game, PixelJunk Racers which involves slot cars that can change lanes.

Obviously each lane would need a path, but the object would need to be able to jump from path to path easily without relying on nodes as a point of changeover. I haven't actually tried the plugin yet, but was more or less wondering if something like this would be possible without spending a lot of time only to discover it's not.

I already have an idea how I may be able to "trick" it into working, however I can already forsee issues with my proposed "trick/hack". Having say 5 paths, with 1 car on each path that follow each other exactly around the circuit... then when a lane change occurs simply delete the car from path X and move to path Y, and throw in a "ghost" car for the lane change animation as such.

Anyway... am I barking up the wrong tree? I frequently do.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Fri Aug 13, 2010 8:25 pm

I can see where path branching would com in handy for this if the cars can change lanes only at certain locations. Here's a way to do the lane changing at any point of the path:
EX: [url:24g24a9f]http://dl.dropbox.com/u/5426011/examples/lanechange.cap[/url:24g24a9f]

The track is defined by one path and other lanes are defined by perpendicular offsets from the path, then the car's path is made as it goes.
B
79
S
24
G
54
Posts: 4,735
Reputation: 40,733

Post » Sat Aug 28, 2010 5:44 pm

If im not greatly mistaken, this is awesome for interpolation of online games? (when a new packet arrives you could create a curve based on the starting position and velocity vectors and the end ones?)
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Sun Sep 05, 2010 6:37 pm

Would it be possible to add some expressions like nodeX and nodeY and and action for each node?
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Mon Oct 04, 2010 1:51 am

a deceleration thing would be great like if the next node have an angle superior to 90 the sprite will decelerate to avoid out of track.
B
3
S
2
G
2
Posts: 136
Reputation: 1,347

Post » Wed Oct 20, 2010 5:06 am

[quote="SoldjahBoy":90xygnk5]Obviously each lane would need a path, but the object would need to be able to jump from path to path easily without relying on nodes as a point of changeover.

[...]

Having say 5 paths, with 1 car on each path that follow each other exactly around the circuit... then when a lane change occurs simply delete the car from path X and move to path Y, and throw in a "ghost" car for the lane change animation as such.[/quote:90xygnk5]

I'd say have a single path, since if you have many, nothing guarantees they'll stay in synch along the path (at a bend, the paths on the outside will be longer, and they might get behind). Just have a "pace car" object following the path and then place your car offset to the right or left of the proxy a fixed number of units. Make sure road art is sized accordingly and avoid hard turns, as Path Behavior does not do smooth bends and the cars outside the main lane will seem to jump around.

To smoothen bends, I've thought about making the "pace car" follow another proxy object with the path behavior. The "pace car" would follow the proxy smoothly, thus softening bends. How to do this without getting behind the proxy? I have no idea yet :P
I'll appreciate ideas on smooth path following, as I kind of need it for my game :P
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Wed Oct 20, 2010 6:33 am

Scale path would be an interesting idea.

Edit:
Actually you can kind of do that now via image points.
If you add a bunch of image points to a sprite then arrange them like your track, and name them sequentially, all you would need to do is make a loop, clear the old path, scale the sprite, then do your loop again.

Add node at imagepoint(loopindex)... blah blah blah

Edit2:
Course you would have to come up with some way of tracking where you are on the path, and getting to the new position on the path.

An actual sale path would be a lot easier.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Oct 20, 2010 4:08 pm

you can scale the position of a proxy object in the path :D
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Fri Dec 10, 2010 12:04 am

I think there may be a possible bug with "clear all nodes". Every time I do that it goes back to the starting node, even if I add one right after that, a tick after to boot.

Also, is there any way to slow the turning on angle to path?
It would be nice if the sprites rotation was a constant speed.

And is there a way to set deceleration?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Dec 13, 2010 2:38 am

[quote:1flgyb0c]I think there may be a possible bug with "clear all nodes". Every time I do that it goes back to the starting node, even if I add one right after that, a tick after to boot.[/quote:1flgyb0c]
It appears to fix it by doing this after you clear then add nodes:
[code:1flgyb0c]-> Sprite: Set distance to 0 on the path, moving Object.
[/code:1flgyb0c]

[quote:1flgyb0c]Also, is there any way to slow the turning on angle to path?
It would be nice if the sprites rotation was a constant speed.[/quote:1flgyb0c]
Disable "Angle to path" for better control. You can make the max rotation speed of 50 degrees per second with a event like this:
[code:1flgyb0c]+ System: Always (every tick)
-> Sprite: Rotate 50*TimeDelta degrees toward (.X+cos(Sprite[PathMovement].GetAngle),.Y+sin(Sprite[PathMovement].GetAngle))
[/code:1flgyb0c]

[quote:1flgyb0c]And is there a way to set deceleration?[/quote:1flgyb0c]
You can cause deceleration by setting the acceleration in the opposite direction as the velocity. The only catch is it will slow to zero and then accelerate past it.
B
79
S
24
G
54
Posts: 4,735
Reputation: 40,733

PreviousNext

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest