I have managed to get my tunnel to move now - it was quite easy too!
http://fpc4gp2x.eonclash.com/downloa...ng_tunnel.html
I just stored an array of tunnel segement Z positions, and decreased those over time.
When the first segment goes past the near clipping plane I move all the segments in the array down one position and make the last one equal the second last one + a segment distance
Code:
procedure TVectored.ScrollTunnel(const aTimeSlice: Single);
var
i: Integer;
begin
for i := cMaxTunnelRings - 1 downto 0 do
FTunnelRingsZ[i] := FTunnelRingsZ[i] - cTunnelSpeed * aTimeSlice;
if FTunnelRingsZ[0] < FGraphics3d.NearZ then
// move tunnel rings forward and put 1st one in back
begin
for i := 1 to cMaxTunnelRings - 1 do
FTunnelRingsZ[i - 1] := FTUnnelRingsZ[i];
FTunnelRingsZ[cMaxTunnelRings - 1] := FTunnelRingsZ[cMaxTunnelRings - 2] + cTunnelRingSpacing;
end;
end;
PS. hey guys, when are we getting Pascal code tags?!?!
cheers,
Paul
Bookmarks