Skip to content

CameraProject

Claude edited this page Oct 27, 2026 · 6 revisions
Blitz3D

CameraProject

CameraProject camera:Int32, x:Float32, y:Float32, z:Float32
Parameter Type Default Description
camera Int32 required Camera handle.
x Float32 required X coordinate in the world.
y Float32 required Y coordinate in the world.
z Float32 required Z coordinate in the world.

Description

Works out where a point of the world lands on the screen. The result is not returned: read it afterwards with ProjectedX, ProjectedY and ProjectedZ. X and Y are pixels of the graphics buffer and Z is the distance of the point in front of the camera. A point behind the camera or a camera that is off gets Y and X far outside the screen, so check ProjectedZ before drawing. Use it to put 2D labels, health bars or a lens flare on a 3D position.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
light = CreateLight()
RotateEntity light, 45, 45, 0
cube = CreateCube()
PositionEntity cube, 1, 0.5, 6
TurnEntity cube, 25, 30, 0
RenderWorld
CameraProject camera, EntityX(cube), EntityY(cube) + 2, EntityZ(cube)
If ProjectedZ() > 0 Then
	Color 255, 255, 0
	Text ProjectedX(), ProjectedY(), "cube", 1, 1
EndIf
Flip
WaitKey

Media

CameraProject

Related Commands

CameraClsColor, CameraClsMode, CameraFogColor, CameraFogMode, CameraFogRange, CameraProjMode, CameraRange, CameraViewport

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally