natiny.physics.cube

Lua
natiny.physics.cube([w [, h [, d]]]) -> body

Creates a dynamic box-shaped body at the world origin.

Parameters

Name Type Default Description
w number 1 Width, the full size along X
h number w Height, the full size along Y
d number w Depth, the full size along Z

Returns

Type Description
number Body handle, also usable as an entity handle

Example

Lua
local body = natiny.physics.cube(1, 1, 1)

Notes

  • Sizes are full extents. The box is centred on the body's origin, and the body starts at the world origin.
  • The body is dynamic; natiny.physics.set_type changes that.
  • Scaling the entity does not scale the collider.
  • Lua raises an error when physics is not running or the body cannot be made.