Blitz3D+ Command Reference

PhysicsShapeLocalMinY# ( shape )

Parameters

shape - live physics shape handle

Description

Returns the minimum Y of a shape's body-local bounds.

Returns the minimum Y coordinate of the collider's geometric axis-aligned bounds in body-local metres, after its authored local translation/rotation and baked source scale. Supports spheres, capsules, hulls, meshes and terrain. Bounds enclose actual geometry and exclude broad-phase padding; they do not include the body's world transform. Use PhysicsShapeMinX/Y/Z and PhysicsShapeMaxX/Y/Z for world bounds.

This is read-only. Wrong-kind/stale handles and unsupported typed inspections raise runtime errors. Frame/dimension authoring metadata is wrapper state; native geometry effects are recorded, but physics replay does not reconstruct editable source entities.

Requires Extended mode.

See also: PhysicsShapeSphere, PhysicsShapeCapsule, PhysicsShapeBox, RefreshPhysicsHull, RefreshPhysicsMesh, PhysicsShapeRadius.

Example

; PhysicsShapeLocalMinY Example
; -----------------------------
; Requires Extended mode.

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

Const PHYSICS_STATIC=0
Const PHYSICS_DYNAMIC=2

camera=CreateCamera()
PositionEntity camera,0,3,-7
RotateEntity camera,20,0,0

light=CreateLight()
RotateEntity light,45,-30,0
AmbientLight 60,60,60

; An independent Box3D world with standard gravity
world=CreatePhysicsWorld()

; Blue static floor
ground=CreateCube()
ScaleEntity ground,6,0.5,6
PositionEntity ground,0,-0.5,0
EntityColor ground,80,160,255
ground_body=CreatePhysicsBody(world,ground,PHYSICS_STATIC)
ground_shape=PhysicsBodyBox(ground_body,12,1,12)

; A crate with a ball fixed on top: one body, two shapes
cargo=CreatePivot()
crate=CreateCube(cargo)
ScaleEntity crate,0.5,0.5,0.5
EntityColor crate,255,120,70
ball=CreateSphere(12,cargo)
ScaleEntity ball,0.4,0.4,0.4
PositionEntity ball,0,0.9,0
EntityColor ball,120,220,120
cargo_body=CreatePhysicsBody(world,cargo,PHYSICS_DYNAMIC)
crate_shape=PhysicsBodyBox(cargo_body,1,1,1)
ball_shape=PhysicsBodySphere(cargo_body,0.8,1,0,0.9,0)
ResetPhysicsBody cargo_body,0,2,0,0.4,0.3,0.2

; A see-through yellow box shows the bounds
bounds=CreateCube(cargo)
EntityColor bounds,255,230,60
EntityAlpha bounds,0.3

While Not KeyDown(1)

    ; Space tosses the body, R drops it again
    If KeyHit(57)
        PhysicsBodyImpulse cargo_body,0,6,0
        PhysicsBodyAngularImpulse cargo_body,1,0,0.5
    EndIf
    If KeyHit(19) Then ResetPhysicsBody cargo_body,0,2,0,0.4,0.3,0.2

    StepPhysics world,1.0/60.0,4

    ; The ball shape's bounds in the body's own coordinates, so the box turns with it
    min_x#=PhysicsShapeLocalMinX(ball_shape)
    min_y#=PhysicsShapeLocalMinY(ball_shape)
    min_z#=PhysicsShapeLocalMinZ(ball_shape)
    max_x#=PhysicsShapeLocalMaxX(ball_shape)
    max_y#=PhysicsShapeLocalMaxY(ball_shape)
    max_z#=PhysicsShapeLocalMaxZ(ball_shape)
    PositionEntity bounds,(min_x+max_x)/2,(min_y+max_y)/2,(min_z+max_z)/2
    ScaleEntity bounds,(max_x-min_x)/2,(max_y-min_y)/2,(max_z-min_z)/2

    ; 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: toss   R: reset   Esc: exit"
    Text 0,20,"PhysicsShapeLocalMinY(ball_shape) = "+min_y
    Text 0,40,"(min X "+min_x+", Z "+min_z+")"
    Text 0,60,"Local bounds are measured in the body's frame"

    Flip

Wend

FreePhysicsWorld world
End

Index