natiny.physics.capsule
Lua
natiny.physics.capsule([radius [, height]]) -> body
Creates a dynamic body with a capsule collider standing upright along Y and
centred on its origin. Requires an initialised physics world.
Parameters
| Name |
Type |
Default |
Description |
radius |
number |
0.5 |
Radius of the side and of both hemispheres, in metres; must be greater than 0 |
height |
number |
radius * 4 |
Total height end to end, hemispheres included, in metres |
Returns
| Type |
Description |
number |
Body handle; raises an error on failure |
Example
Lua
local player = natiny.physics.capsule(0.4, 1.8)
natiny.physics.set_fixed_rotation(player, true)
natiny.model.set_mesh(avatar, natiny.mesh.capsule(0.4, 1.8))
natiny.entity.set_parent(avatar, player)