CameraZoom does not get tweened

Blitz3D Forums/Blitz3D Programming/CameraZoom does not get tweened

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi all.

This is more or less just an FYI:

I was recently looking at one of my projects and noticed that the camera was a bit jerky when zooming in and out.

I found the problem:

CameraZoom values do not get tweened!

A very very simple bit of code to demonstrate:

Graphics3D 640,480,16,2
cube=CreateCube()
camera=CreateCamera()
light=CreateLight()
MoveEntity camera,0,10,0
PointEntity camera,cube
CameraZoom camera,1
CaptureWorld
TurnEntity cube,179,0,0
Repeat
	CameraZoom camera,Rand(2)
	For n#=0 To 1 Step .01
		RenderWorld n#
		Flip
		If KeyHit(1) Then End
	Next
Until False


Um, Is this a bug? (should i post it there?)


I got around it by storing zoom values and doing a bit of maths before rendering, but this is one of the commands useful in creating TV type camera views, and this was a pain in the ass until i found out why it wasnt working!

EDIT:

Heres an example of the "fixed" loop:

Graphics3D 640,480,16,2
cube=CreateCube()
camera=CreateCamera()
light=CreateLight()
MoveEntity camera,0,10,0
PointEntity camera,cube

CameraZoom camera,1
Startzoom#=1 ;Start zoom, part of tween fix

CaptureWorld
TurnEntity cube,179,0,0
Repeat
	newzoom#=Rnd(1,4); Target zoom
	For n#=0 To 1 Step .01
		CameraZoom camera,Float(startzoom+(newzoom-startzoom)*n) 	;The part inside FLOAT calculates what the zoom level should be for this "tween#" value.
;what the zoom level should be for this "tween#" value, using the old and new zoom values.
		RenderWorld n#
		Flip
		If KeyHit(1) Then End
	Next
	Startzoom#=newzoom ;Store the newest zoom

Until False