Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit2e536ca9a9

README.md

sc.spawnModel (deprecated)

Deprecated — superseded by the entityOps / scene / appearance toolboxes. To spawn an entity displaying a mesh, use the entity API:

local e = entity.spawn({ name = "name" })
e.component.add("Model", { model = "<mesh>" })   -- model = a mesh name, asset.ref, or MeshHandle
e.position = { x, y, z }

Spawns an entity carrying a model at a position, with a collider and static physics by default. The model can be given as a guid, a vfs path, an @identity, or an asset ref, but it must resolve to a bundle or mesh; a literal model value is checked against the project's assets before the call runs, so the wrong asset kind is caught early. The position can be passed as individual numbers, a vector table, or fields in the options table, and the options also set physics mode (static, dynamic, or none), scale, and rotation. Returns the new entity's id. This is the everyday tool for putting a thing in the scene.