a shakey cam - needs steadying

Blitz3D Forums/Blitz3D Programming/a shakey cam - needs steadying

danjo(Posted 2005) [#1]
i have some code that seems to have parkinsons disease.. can anyone point out what maybe going wrong here..
Global gameFPS = 50
Global follow_angle=0,follow_radius#=20.0,follow_high#=6.0
;timer
Global gametimer00=MilliSecs()
Global framePeriod = 1000 / gameFPS
Global frameTime = MilliSecs () - framePeriod
Global tweening=True

Graphics3D 640,480,0,2
Global man=CreateCube()
Global followpivot=CreatePivot()
Global manpivot=CreatePivot()
Global cam=CreateCamera()

test_level()

End

Function test_level()
;LOOP
Repeat
	Repeat
		frameElapsed = MilliSecs () - frameTime
	Until frameElapsed
	frameTicks = frameElapsed / framePeriod
	frameTween# = Float (frameElapsed Mod framePeriod) / Float (framePeriod)
	
	For frameLimit = 1 To frameTicks
		If frameLimit = frameTicks Then CaptureWorld
		frameTime = frameTime + framePeriod
		
		;DRAW 3D
		place_follow_cam()

 		UpdateWorld 	       
	Next
	;render the world with instant or tweening (smooth)
	If tweening=True
		RenderWorld frameTween
	Else
		RenderWorld
	EndIf

	;DRAW 2D & WINDOWS
	Text 0,0,"F1/F2 =spin around cube, F3/F4 =zoom in/out, F5/F6 = adjust height, F7 =Reset"
	Flip
		
Until KeyHit (1)
End Function

Function place_follow_cam()
f_keys()
tx=Float(EntityX(man)+Cos(follow_angle+90)*follow_radius#)
ty=Float(EntityZ(man)+Sin(follow_angle+90)*follow_radius#)
th=(h_spot*8)+follow_high#

PositionEntity followpivot,tx,th,ty
PositionEntity manpivot,EntityX(man),EntityY(man)+6,EntityZ(man)

PositionEntity cam,EntityX(followpivot),EntityY(followpivot),EntityZ(followpivot)
PointEntity cam,manpivot
End Function



fredborg(Posted 2005) [#2]
It's rock steady here, but 'Function f_keys() not found' :)

My guess is that tx,ty and th needs to be floats in 'place_follow_cam()'


danjo(Posted 2005) [#3]
Goddam, thanks..
its 1 am here, and i cant see wood for trees :p

i forgot to paste in the f_keys function - but the float was the problem