Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit44fd9e59bd

README.md

LookAtConstraint

Rotates an entity to face a target entity or a fixed world position. Use weight for partial/smoothed orientation.

Public fields: targetEntityId, targetPositionX/Y/Z, axisX, axisY, axisZ, weight.

targetEntityId names the entity to face: write the entity, its id or its name, and it reads back as the entity; a name is found when the constraint is applied. It is an entity reference, so a constraint a scene's build.luau writes between two entities the build spawns (targetEntityId = target or targetEntityId = target.id) names the entity the build placed, through every rebuild, save, load and play.

Methods: setTarget(entityId), setWeight(w).

entity(id).component.add("LookAtConstraint", {
    targetEntityId = entity.find("player"),
    weight = 0.5,
})