|
x#, y#, z# - world-space position to mark size# (optional) - overall length of each cross arm, in world units; must be positive; .1 (default) red (optional) - red part of the colour, 0-255; 255 (default) green (optional) - green part of the colour, 0-255; 255 (default) blue (optional) - blue part of the colour, 0-255; 255 (default) depth_test (optional) - True hides the marker behind closer geometry, False draws it through everything; True (default) |
|
Queues a small three-axis cross at a world-space point for the next RenderWorld. DebugPoint marks an exact spot with three short lines crossing along the X, Y and Z axes - much easier to spot in 3D than a single dot. Use it to show where a pick hit (PickedX/PickedY/PickedZ), where an entity will spawn, a patrol waypoint, or the contact point of a collision. Like every Debug command, the marker lives for exactly one RenderWorld: the queue is drawn by the next RenderWorld and then cleared, so call DebugPoint every frame for as long as you want it visible. A size of zero or less stops the program with a runtime error. With depth_test True (the default) the cross can hide behind walls; pass False to keep it visible through geometry. See also: DebugLine, DebugSphere, DebugBox, ClearDebugDraw. |
; DebugPoint Example
; ------------------
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,4,-10
light=CreateLight()
RotateEntity light,45,45,0
; Four patrol waypoints arranged in a square
Dim wx#(3),wz#(3)
For n=0 To 3
wx(n)=3*Cos(n*90)
wz(n)=3*Sin(n*90)+2
Next
; An enemy that walks the waypoint route
enemy=CreateCube()
ScaleEntity enemy,0.5,0.5,0.5
PositionEntity enemy,wx(0),0,wz(0)
show=True
target=1
While Not KeyDown(1)
; Space toggles the debug overlay
If KeyHit(57) Then show=Not show
; Step the enemy towards its target waypoint
dx#=wx(target)-EntityX(enemy)
dz#=wz(target)-EntityZ(enemy)
dist#=Sqr(dx*dx+dz*dz)
If dist<0.1 Then target=(target+1) Mod 4 Else PositionEntity enemy,EntityX(enemy)+0.05*dx/dist,0,EntityZ(enemy)+0.05*dz/dist
If show Then
; DebugPoint queues a cross at each waypoint; the current target is red and larger
For n=0 To 3
If n=target Then DebugPoint wx(n),0,wz(n),0.5,255,80,80 Else DebugPoint wx(n),0,wz(n),0.25,255,255,255
Next
EndIf
; 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 overlay Esc: exit"
If show Then Text 0,20,"DebugPoint marks the patrol waypoints - red is the current target" Else Text 0,20,"Overlay off - press Space"
Flip
Wend
End