how to choose which waypoint next?

Blitz3D Forums/Blitz3D Beginners Area/how to choose which waypoint next?

Hey Puki, thank you very much, these ideas are indeed very helpful. I will change structure of waypoint to be:

numer of waypoint, lane, position in x, in y, in z, overtake value

PointNew.wayPoint( 1, 1, 2.014, 2, -3, 5); = lane 1
PointNew.wayPoint( 1, 2, -2.014, 2, -3, 5); = lane 2

I'm using at the moment:

 
Function drivePath(p.cars)
	For this.waypoint = Each wayPoint
		If this\number = p\nextpoint Then

;choose which lane based on distance to player  + overtake value, from 1 to 3
if entitydistance(p\geo, player) < 10 then
changelane...; stuck in here :S
end if

			Point_Entity(p\geo,EntityX(this\geom),EntityY(this\geom),EntityZ(this\geom))
			Local sp#=Rnd (1.7,2.3 )
			MoveEntity p\geo,0,0,sp
			closeRange= Rand(3,7)
			If EntityDistance(p\geo,this\geom) < closeRange Then
				p\nextpoint = p\nextpoint+1
				If p\nextpoint > MAX_POINTS Then p\nextpoint = 1; MAX_POINTS = total number of waypoints
			End If
		End If
	Next
End Function



But... how do you actually change lanes? As you can see, still trying to learn.

Thanks.