Model

self:look_at

Shared

Rotates the model so its -Z axis points toward the given world-space target

Syntax

local status = self:look_at(
    target,
    up = {0, 1, 0}
)

Parameters

TypeNameDescription
vector3targetWorld-space position to look at as {x, y, z}
vector3upUp vector used to determine orientation as {x, y, z}

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Point a model at the world origin
core.model.load("character", "models/character.glb")

local entity = core.model.create("character")

entity:set_position({0, 10, 0})
entity:look_at({0, 0, 0}, {0, 1, 0})

On this page