Blitz3D+ Command Reference

DebugEntityAxes entity[,recursive][,size#][,depth_test]

Parameters

entity - entity whose axes to draw

recursive (optional) - True also draws axes for every descendant of the entity; False (default)

size# (optional) - length of each axis line in world units; must be positive; 1 (default)

depth_test (optional) - True hides the axes behind closer geometry, False draws them through everything; True (default)

Description

Queues an entity's local X, Y and Z axes, drawn from its live world transform, for the next RenderWorld.

DebugEntityAxes draws three coloured lines out of the entity's origin: red for local X, green for local Y and blue for local Z. The colours are fixed so you always know which axis is which. It answers orientation questions instantly - why a model strafes when it should walk forward, which way an emitter is pointing, whether a turret really turned to face its target.

With recursive True the axes are drawn for the whole hierarchy under the entity too - a quick way to inspect every part of a loaded model, or every bone-attached prop on a character.

Like every Debug command, the axes live for exactly one RenderWorld: the queue is drawn by the next RenderWorld and then cleared, so call DebugEntityAxes every frame for as long as you want them visible. A zero or negative size stops the program with a runtime error.

Requires Extended mode.

See also: DebugEntityBounds, DebugSkeleton, DebugGrid, ClearDebugDraw.

Example

; DebugEntityAxes Example
; -----------------------
; Requires Extended mode.

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,1,-6

light=CreateLight()
RotateEntity light,45,45,0

; A tumbling cargo crate - its local axes are hard to guess without help
crate=CreateCube()
EntityColor crate,180,130,70

show=True
size#=1.5

While Not KeyDown(1)

    ; Space toggles the axes, [ and ] change their length
    If KeyHit(57) Then show=Not show
    If KeyHit(26) And size>0.5 Then size=size-0.5
    If KeyHit(27) And size<4 Then size=size+0.5

    ; Tumble the crate on two axes
    TurnEntity crate,1,2,0.5

    ; DebugEntityAxes queues red X, green Y and blue Z axes at the crate's world transform
    If show Then DebugEntityAxes crate,False,size

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Text 0,0,"Arrow keys: move camera   Space: toggle axes   [ / ] : size   Esc: exit"
    If show Then Text 0,20,"DebugEntityAxes crate,False,"+size+"   (red=X green=Y blue=Z)" Else Text 0,20,"Axes off - press Space"

    Flip

Wend

End

Index