natiny_physics_cube

C
NatinyBody natiny_physics_cube(float w, float h, float d);

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

Parameters

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

Returns

Type Description
NatinyBody Body handle, also usable as a NatinyEntity; 0 on failure

Example

C
NatinyBody body = natiny_physics_cube(1.0f, 1.0f, 1.0f);

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.
  • Returns 0 when physics is not running or the body cannot be made.