Skip to content

PhysicsUpdate

Narta Xaymar Dirks edited this page Nov 5, 2026 · 1 revision
BlitzLLVM

PhysicsUpdate 〔BlitzLLVM〕

PhysicsUpdate:Void delta_time:Float32=0, world:Int32=0
Parameter Mode Type Default Description
delta_time In Float32 0 The time since the last call in seconds. 0 (default) measures it. Pass a constant, e.g. 1.0 / 60, for runs that are the same every time.
world In Int32 0 The physics world, 0 (default) for the default world.

Description

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

Moves the bodies of a world forward in time. Nothing moves until this is called, UpdateWorld does not step physics.

Before the step, a body whose entity the program moved (PositionEntity, RotateEntity, a new parent, ...) is put where its entity is. After it, every awake dynamic body is where the simulation left it, which is also what EntityX, EntityY and EntityZ say.

How the time is spent depends on PhysicsMode. With fixed steps (the default) the time is added to what is left of the last call and the world takes as many steps of 1 / PhysicsRate seconds as fit, at most PhysicsMaxSteps; time that does not fit is dropped. RenderWorld then draws the bodies between the last two steps, so they move smoothly at any frame rate. With frame steps the world takes one step of exactly the time given (at most PhysicsMaxDelta), and nothing is interpolated.

A force given by PhysicsApplyForce acts in every step of the next call, an impulse acts once.

Differences

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

Examples

Graphics3D 640, 480, 32, 2
camera = CreateCamera()
PositionEntity camera, 0, 3, -12
light = CreateLight()

floor = CreatePhysicsBody(1, 1, 20, 0.5, 20)
PositionEntity floor, 0, -0.5, 0
crate = CreatePhysicsBody(1, 3, 0.5, 0.5, 0.5)
PositionEntity crate, 0, 5, 0

While Not KeyHit(1)
	PhysicsUpdate
	RenderWorld
	Flip
Wend

Related Commands

PhysicsAngularDamping 〔BlitzLLVM〕, PhysicsAngularVelocity 〔BlitzLLVM〕, PhysicsApplyAngularImpulse 〔BlitzLLVM〕, PhysicsApplyForce 〔BlitzLLVM〕, PhysicsApplyForceAt 〔BlitzLLVM〕, PhysicsApplyImpulse 〔BlitzLLVM〕, PhysicsApplyImpulseAt 〔BlitzLLVM〕, PhysicsApplyTorque 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally