Timing movements in seconds?

Blitz3D Forums/Blitz3D Beginners Area/Timing movements in seconds?

Hi,

I need a timing system that uses seconds and not animation frames to govern the movements of objects in a scene.

The CreateTimer(), WaitTimer() approach is no good in this instance because it uses frame frequency.

Can someone who knows basic mathematics show me why the following code doesn't work.

; Basic timed movement
; ------------------
;
; doesn't work. Why?
;
; need to move the object over a set distance (6.5) in a set time (3 secs) 
; time needs to be in seconds NOT frames


; Set 3D graphics mode
Graphics3D 640,480,16,0
SetBuffer BackBuffer()

camera=CreateCamera()
light=CreateLight()

cone=CreateCone( 32 )
PositionEntity cone,-3,0,5

distance#   = 6.5 ;blitz units
time#       = 3.0 ;secs
speed#      = Float(distance / time)

currentpos# = 0.0 

While Not KeyDown( 1 )
		
	If (currentpos < distance)
	
		MoveEntity(cone, speed, 0, 0)
		currentpos = currentpos + speed
		
	EndIf

	UpdateWorld()
	RenderWorld()
	
	Flip

Wend

ClearWorld()

End



Thanks,

Rogue Vector