Blitz3D+ Command Reference

SetCollisionBackend backend

Parameters

backend - collision implementation used by Collisions and UpdateWorld
0: legacy Blitz3D collision sweeps (default)
1: shared Box3D collision and entity-physics solver

Description

Selects the implementation behind the classic Collisions and UpdateWorld commands.

The setting belongs to the currently selected 3D world. Remove explicit EntityPhysics enrollment before switching backends. An accepted switch retires the old collision results and implicit bodies; register the desired rules and call ResetEntity for deliberate teleports before the next UpdateWorld.

Backend 1 keeps the familiar entity types and collision-query commands, but Box3D's contact solver determines the final movement. A classic source becomes a controlled dynamic body; ordinary destination-only entities become kinematic bodies, so moving platforms transfer contact velocity naturally. Polygon destinations remain static. Method 1 uses EntityCapsule when the destination has an active capsule definition, enabling capsule-to-capsule rules; otherwise it uses EntityRadius. Do not attach a standalone CreatePhysicsBody body to the same participant.

Classic controlled movers receive no automatic gravity; continue authoring their downward movement before UpdateWorld. Free props enrolled with EntityPhysics receive WorldGravity, defaulting to (0,-9.81,0). They share the same solve. Enable physical type pairs with Physics, using different pairs from Collisions. One Blitz tick is one sixtieth of a physics second. Authored fast movement uses bounded solver slices and the native speed limit; use ResetEntity for deliberate teleports.

Physical response mapping differs deliberately from the legacy plane projection: response 0 is a reporting sensor; response 1 is a solid regular-friction contact; response 2 is a zero-friction solid; response 3 is a zero-friction solid whose controller intent retains its vertical component; and response 4 is a strong-friction grip contact intended for moving platforms. Grip is not a weld and applies to every face in the collision type pair, so use a separate slide rule for ordinary scenery walls. Exact polygon method 2 accepts static meshes, terrain and BSP only. Use method 3 or method 4 for moving scenery.

Requires Extended mode.

See also: CollisionBackend, Collisions, EntityCapsule, EntityConvex, UpdateWorld.

Example

; SetCollisionBackend Example
; ---------------------------
; Requires Extended mode.

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

; Select the hidden Box3D contact solver before registering collisions
SetCollisionBackend 1

; Camera fixed on the arena - the arrow keys steer the player instead
camera=CreateCamera()
PositionEntity camera,0,4,-9

light=CreateLight()
RotateEntity light,50,30,0

; A capsule-collided player
player=CreatePivot()
model=CreateCylinder(16,True,player)
ScaleEntity model,0.5,1,0.5
EntityCapsule player,0.5,2
EntityType player,1
PositionEntity player,0,2,0

; A solid floor to land on
floor=CreateCube()
ScaleEntity floor,4,0.25,4
EntityBox floor,-1,-1,-1,2,2,2
EntityType floor,2

Collisions 1,2,3,1
ResetEntity player

While Not KeyDown(1)

    ; Classic character code: steer, apply gravity, let the solver respond
    If KeyDown(203) Then TranslateEntity player,-0.06,0,0
    If KeyDown(205) Then TranslateEntity player,0.06,0,0
    TranslateEntity player,0,-0.035,0

    UpdateWorld 1

    ; Show the hidden Box3D colliders
    DebugEntityCollider player,0
    DebugEntityCollider floor,3

    RenderWorld

    Text 0,0,"Left/Right: move player   Esc: exit"
    Text 0,20,"SetCollisionBackend 1   CollisionBackend() = "+CollisionBackend()

    Flip

Wend

End

Index