natiny.physics.mesh

Lua
natiny.physics.mesh(mesh) -> body

Creates a static body whose collider is a mesh, triangle for triangle.

Parameters

Name Type Description
mesh number Mesh handle, from natiny.mesh.load or a generated shape

Returns

Type Description
number Body handle, also usable as an entity handle; raises an error on failure

Example

Lua
local resource = natiny.resource.load("level.glb")
local level = natiny.mesh.load(resource)
local body = natiny.physics.mesh(level)