Skip to content

CreatePhysicsBody

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

CreatePhysicsBody 〔BlitzLLVM〕

CreatePhysicsBody:Int32 shape:Int32, motion:Int32, a:Float32, b:Float32, c:Float32, parent:Int32=0, world:Int32=0
Parameter Mode Type Default Description
shape In Int32 required 1 to 6, see the table.
motion In Int32 required 1 static, 2 kinematic, 3 dynamic.
a In Float32 required First size, see the table.
b In Float32 required Second size.
c In Float32 required Third size.
parent In Int32 0 The entity to make the child of, 0 for none.
world In Int32 0 The physics world, 0 (default) for the default world.

Returns: The body, which is an entity.

Description

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

Creates a rigid body from one of the standard shapes and returns it. The body is an entity (a pivot, with nothing to see), so PositionEntity, RotateEntity, EntityParent, FreeEntity and the other commands for entities work on it, and a mesh that is its child is drawn where the body is. It starts at the origin of its parent with a mass of 1 kilogram, with PhysicsMass for others.

Shapes, and what a, b and c are:

Shape a b c
1 box half width half height half depth
2 sphere radius
3 ellipsoid radius in x radius in y radius in z
4 capsule radius half height of the straight part
5 cylinder radius half height
6 tapered capsule radius at the top radius at the bottom half height of the straight part

A CreateCube is a box of 1, 1, 1. Motions: 1 static (never moves, cheapest), 2 kinematic (moved by the program, pushes everything and is not pushed), 3 dynamic (moved by forces and contacts). The scale of the entity is not used: the size is the one given here.

A body does not collide with the entities of Collisions and they do not know of it. An entity that has a body can not be given an EntityType.

Differences

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

Examples

ball = CreatePhysicsBody(2, 3, 0.5, 0, 0)
PositionEntity ball, 0, 4, 0
PhysicsRestitution ball, 0.8
sphere = CreateSphere(12, ball)
ScaleEntity sphere, 0.5, 0.5, 0.5

Related Commands

CreatePhysicsBodyFromEntity 〔BlitzLLVM〕, CreatePhysicsWorld 〔BlitzLLVM〕, FreePhysicsWorld 〔BlitzLLVM〕, GetPhysicsBodyMotion 〔BlitzLLVM〕, GetPhysicsBodyShape 〔BlitzLLVM〕, GetPhysicsBodyWorld 〔BlitzLLVM〕, PhysicsBodyMotion 〔BlitzLLVM〕, PhysicsBodyWorld 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally