Skip to content

PhysicsCapsuleCast

Narta Xaymar Dirks edited this page Nov 24, 2026 · 2 revisions
BlitzLLVM

PhysicsCapsuleCast 〔BlitzLLVM〕

PhysicsCapsuleCast:Int32 x1:Float32, y1:Float32, z1:Float32, x2:Float32, y2:Float32, z2:Float32, radius:Float32, half_height:Float32, pitch:Float32=0, yaw:Float32=0, roll:Float32=0, mask_low:Int32=-1, mask_high:Int32=-1, sensors:Int32=0, world:Int32=0
Parameter Mode Type Default Description
x1 In Float32 required Where the shape starts, x. This is the centre of the shape.
y1 In Float32 required Where the shape starts, y.
z1 In Float32 required Where the shape starts, z.
x2 In Float32 required Where the shape ends, x. Bodies beyond this are not hit.
y2 In Float32 required Where the shape ends, y.
z2 In Float32 required Where the shape ends, z.
radius In Float32 required The radius of the capsule.
half_height In Float32 required The half height of the straight part of the capsule, without the two round ends. The capsule stands along y until it is turned.
pitch In Float32 0 The turn of the capsule around x, in degrees, as TurnEntity takes them. 0 (default) is not turned.
yaw In Float32 0 The turn around y, in degrees. 0 (default) is not turned.
roll In Float32 0 The turn around z, in degrees. 0 (default) is not turned.
mask_low In Int32 -1 The layers to look at, as bits 0 to 31 of a mask (bit n is layer n). -1 (default) looks at all layers.
mask_high In Int32 -1 The layers 32 to 63, as bits 0 to 31 of a mask. -1 (default) looks at all layers.
sensors In Int32 0 1 also finds sensors (see PhysicsSensor); 0 (default) leaves them out.
world In Int32 0 The physics world, 0 (default) for the default world.

Returns: The entity of the body that was hit, or 0 if there is none.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Moves a capsule (it stands along y unless it is given a turn) from one point to another through the bodies of a physics world and returns the first body that it touches. It is a ray with a size, which is what a program needs for its own ground checks, wall sliding, camera collision and projectiles. All points are in the world. It sees the bodies as PhysicsUpdate last left them (PhysicsUpdate 0 takes over moves without a step), but not legacy colliders or the meshes of LinePick.

What was hit is kept for GetPhysicsHitEntity, GetPhysicsHitX, GetPhysicsHitY, GetPhysicsHitZ, GetPhysicsHitNX, GetPhysicsHitNY, GetPhysicsHitNZ and GetPhysicsHitDistance until the next ray, shape or point query. The point is where the shape touched, the normal points out of the body and the distance is how far the centre of the shape went. A shape that starts inside a body hits it at distance 0.

Differences

  • The original has no such command. This is an extension; programs that use it do not compile with the original Blitz3D.

Examples

body = PhysicsCapsuleCast(0, 1, 0, 10, 1, 0, 0.3, 0.5)
If body Then Print "Wall after " + GetPhysicsHitDistance()

Related Commands

PhysicsAngularDamping 〔BlitzLLVM〕, PhysicsAngularVelocity 〔BlitzLLVM〕, PhysicsApplyAngularImpulse 〔BlitzLLVM〕, PhysicsApplyForce 〔BlitzLLVM〕, PhysicsApplyForceAt 〔BlitzLLVM〕, PhysicsBoxCast 〔BlitzLLVM〕, PhysicsRayCast 〔BlitzLLVM〕, PhysicsSphereCast 〔BlitzLLVM〕

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally