Moving along a rail

Blitz3D Forums/Blitz3D Programming/Moving along a rail

Fuller(Posted 2006) [#1]
Kinda a challenge almost...
I'm trying to move a "car" along a set track sorta like a roller coaster does. Does anyone know the best way to do this?

And by the way, has anyone made pinball in Blitz3d

<PINBALL FREAK>


Boiled Sweets(Posted 2006) [#2]

And by the way, has anyone made pinball in Blitz3d



Never seen one maybe cos Blitz3d doesn't intrinically do physics, but using one of the physics engine would make this a little easier I guess.

The thing is it's a lot of work and it probably wouldn't sell so for commercial purposes it might be a dead duck type of project, not too say that it would not be fun etc etc...

Why not write one?


Shambler(Posted 2006) [#3]
You need to have a bunch of nodes stored in an array which represent the tracks position and rotation ( rotation would allow you to have the 'car' appear to go upside down on a twisted track rail like alot of coasters do ).

I would use an array of pivots, with each pivot in the array physically pointing to the next ( using point entity ).

Start the car off at the first pivot and then interpolate its position/rotation based on the next pivot's position and rotation.


LAB[au](Posted 2006) [#4]
Plenty of ways to do it. Quite the same idea as Shambler, but instead of an array, you could simply model your track, then get vertices position to move your car on it (still using interpolated coordinates). The good thinh about it is that you could let the 3d modelling software interpolating curved parts...


Weetbix(Posted 2006) [#5]
Anyone wanna whip up an example of this?


Stevie G(Posted 2006) [#6]
I don't think you need interpolated coords. Build the track in such a way that the sides extrude like so ..

View from behind the car
ccc = car chassis
w = wheel
* = Track ( slightly wider than wheel base )

   ccc    
* wcccw *
*********



Your car should consist of a visible entity and 2x pivots representing the front and rear axles, set to sliding collisions . The 2 x collision pivots would have to be constrained so that they stay within the length of the wheelbase ( same way as verlet ) ... a simple spring system will do the trick here.

When you accelerate apply the acceleration to the rear pivot in the direction of the front pivot and every frame position the visible entity in the center of the 2 pivots, pointing at the front one. Obviously gravity would also need to apply to both pivots.

Due to the constraining the vehicle will turn automatically as the front pivot hits the side of the track.

Probably a bit long winded but just thinging out load here. I'm pretty sure it would work.

What you making .. skalextrix ( spelling??? ) ?

Stevie


IPete2(Posted 2006) [#7]
Hey that's TCR in software - neat!

IPete2.


Zmatrix(Posted 2006) [#8]
what about Agore's Spline's sample in your b3d Sample) folder? (birddemo.bb)
I think they are exported from lightwave,,,but it might give you an idea of how to do it.

Sam


Fuller(Posted 2006) [#9]
Thanks all! I'll try each see which ones the best. I'm not really making anything specific, just had a funny idea for a game.