Preparing search index...

    Rotates an object to face a target point or direction.

        const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
    const scene = model.project.scene;

    const target = scene.createSceneObject('Target');
    const follower = scene.createSceneObject('Follower');
    const lookAt = follower.addComponent('LookAtComponent') as Editor.Components.LookAtComponent;

    lookAt.target = target;
    lookAt.lookAtMode = Editor.Components.LookAtComponent.LookAtMode.LookAtPoint;
    lookAt.aimVectors = Editor.Components.LookAtComponent.AimVectors.ZAimYUp;
    lookAt.worldUpVector = Editor.Components.LookAtComponent.WorldUpVector.SceneY;
    console.log(`LookAt: mode=${lookAt.lookAtMode}, aim=${lookAt.aimVectors}, up=${lookAt.worldUpVector}`);

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    aimVectors: AimVectors

    Which local axes point toward and up relative to the target.

    enabled: boolean

    Whether the component is active.

    id: Uuid

    The unique id of the entity.

    lookAtMode: LookAtMode

    Whether to look at a point or in a direction.

    meta: Meta

    Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

    name: string

    Name of the component.

    offsetRotation: quat

    Additional rotation applied after looking at the target.

    sceneObject: SceneObject

    Scene object this component is attached to.

    target: SceneObject

    Scene object to look at.

    type: string

    The entity's type.

    worldUpVector: WorldUpVector

    Reference axis used as world up.

    Methods

    • Returns the name of this object's type.

      Returns string

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean