Skip to content

SpriteViewMode

Narta Xaymar Dirks edited this page Oct 28, 2026 · 8 revisions
Blitz3D

SpriteViewMode

SpriteViewMode:Void sprite:Int32, view_mode:Int32
Parameter Mode Type Default Description
sprite In Int32 required The sprite.
view_mode In Int32 required 1 to 4, see the table. Any other number turns the sprite neither way, so it behaves like mode 2.

Description

Chooses how a sprite turns in relation to the camera.

Mode Behavior
1 Faces the camera and turns with it, so it always looks flat towards you. This is the default.
2 Fixed: keeps the orientation of the entity itself and ignores the camera, so it can be seen edge-on. Its back is not drawn unless EntityFX has the two-sided flag (16).
3 Faces the camera but keeps the entity's own up direction.
4 Only turns around the vertical axis to face the camera. It stays upright, like a billboard tree.

The example shows all four modes while the camera circles them and tilts from side to side. The arrow on each sprite points to its up direction.

Differences

  • The descriptions in the official help do not exactly match the engine. This page describes what the engine does, and so does this runtime.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
CameraClsColor camera, 70, 100, 160
pivot = CreatePivot()
EntityParent camera, pivot
PositionEntity camera, 0, 3, -8
RotateEntity camera, 15, 0, 0

; One sprite for every view mode, labeled with its number.
For mode = 1 To 4
	tex = CreateTexture(64, 64, 1 + 4096)
	SetBuffer TextureBuffer(tex)
	ClsColor 40 + mode * 40, 200 - mode * 30, 90
	Cls
	Color 255, 255, 255
	For i = 0 To 12
		Rect 32 - i, 4 + i, i * 2 + 1, 1, 1
	Next
	Text 32, 40, Str(mode), 1, 1
	SetBuffer BackBuffer()

	sprite = CreateSprite()
	SpriteViewMode sprite, mode
	EntityTexture sprite, tex
	PositionEntity sprite, -3.6 + (mode - 1) * 2.4, 0, 0
Next

For frame = 0 To 39
	RotateEntity pivot, 0, frame * 4.5, 0
	RotateEntity camera, 15, 0, Sin(frame * 18) * 35
	RenderWorld
	Flip
Next

Media

SpriteViewMode

Related Commands

CreateSprite, HandleSprite, LoadSprite, RotateSprite, ScaleSprite, SpriteDepthFade 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally