Skip to content

CreatePhysicsBodyFromEntity

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

CreatePhysicsBodyFromEntity 〔BlitzLLVM〕

CreatePhysicsBodyFromEntity:Int32 entity:Int32, motion:Int32, shape:Int32=0, world:Int32=0
Parameter Mode Type Default Description
entity In Int32 required The entity to read the geometry of. A terrain and a mesh without triangles can not be used.
motion In Int32 required 1 static, 2 kinematic, 3 dynamic.
shape In Int32 0 0, 1, 3, 4 or 5, see above.
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 new rigid body from the geometry of an entity and returns it. The entity itself is left as it is: it does not become a body, and stays where it is. To show it with the body, make it a child of the body, keeping its place: EntityParent mesh, body, True.

The size and turn of the entity in the world are used. Shapes: 0 automatic (a triangle mesh for static and kinematic bodies, a convex hull for dynamic ones), 1 the box that holds the mesh, 3 the ellipsoid that holds that box, 4 the convex hull of the mesh (of up to 126 corners that were picked to keep its outline) and 5 a triangle mesh, which is exact but can only be static or kinematic. A box and an ellipsoid are placed around the middle of the mesh, so the body is not at the origin of the entity; a hull and a mesh are at the origin. The body starts with a mass of 1 kilogram.

Differences

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

Examples

rock = LoadMesh("rock.b3d")
PositionEntity rock, 0, 6, 0
body = CreatePhysicsBodyFromEntity(rock, 3, 4)
EntityParent rock, body, True

Related Commands

CreatePhysicsBody 〔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