Blitz3D Docs -> 3D - A-Z -> C -> CameraZoom
CameraZoom camera,zoom#
Parameters:
camera - camera handlezoom# - zoom factor of camera
Description:
Sets zoom factor for a camera. Defaults to 1.Example:
; CreateZoom Example
; ------------------
Graphics3D 640,480
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,1,0
light=CreateLight()
RotateEntity light,90,0,0
ground=CreatePlane()
sand_tex=LoadTexture("media/sand.bmp")
ScaleTexture sand_tex,10,10
EntityTexture ground,sand_tex
EntityColor ground,168,133,55
cactus1=LoadMesh("media/CACTUS2.x")
cactus2=LoadMesh("media/CACTUS2.x")
camel=LoadMesh("media/camel.x")
PositionEntity cactus1,-1,2,10
PositionEntity cactus2,1,2,10
PositionEntity camel,0,1,1000
; Set initial zoom value
zoom#=1
While Not KeyDown( 1 )
If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
; Change zoom value depending on key pressed
If KeyDown( 208 )=True Then zoom#=zoom#-0.1
If KeyDown( 200 )=True Then zoom#=zoom#+0.1
; Put a minimum and maximum cap on zoom value
If zoom#<1 Then zoom#=1
If zoom#>100 Then zoom#=100
; Set camera zoom
CameraZoom camera,zoom#
RenderWorld
Text 0,0,"Use left and right cursor keys to turn around"
Text 0,20,"Use up and down cursor keys to change camera zoom"
Text 0,40,"There is a camel on the horizon, inbetween the cacti. Zoom in to see it."
Text 0,60,"CameraZoom camera,"+zoom#
Flip
Wend
End
Comments
| ||
| Users should note that 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 It is therefore recomended you store the zoom values in use when using tweening, and use some simple maths with the CameraZoom function prior to rendering: Camerazoom CapturedZoom#+(Currentzoom#-Capturedzoom#)*Tween# |
| ||
| The default CameraZoom setting of 1.0 will create a fishbown effect. To change the zoom to be a more normal value, use:- CameraZoom camera, 1.6 |
| ||
| The default zoom value (1.0) is a 90 degree angle, perfect for rendering cubemaps/skyboxes. |
Blitz3D Manual Forum
BlitzPlus Equivalent Command




