---
contentHash: sha256:9e1767560c26f3bde9153ce52fe798492724c50d25bccd79ecca43b9a786d312
documentId: element:sk-target-at-constraint
kind: element
schemaVersion: 1
skenraVersion: 0.1.0-alpha.1
---
# sk-target-at-constraint

<a id="overview"></a>

## Overview

Keeps a node aimed at another node, turning a chosen axis to face it — the way
to make an object (or camera) track a moving point.

This is the look-at member of the Constraint family: like every constraint
it drives its constrained target by recomputing from live scene state each frame —
here it recomputes the target's
orientation so the chosen axis keeps pointing at another node, so the aimer
tracks that node even as it moves.

**Key attributes.** `target` names the node to aim at, by `#id` — either any
scene node or a dedicated TargetAt node used as a movable look-at point.
`axis` chooses which of the aimer's local axes points at the target (e.g. `+y`
for an arrow, whose geometry heads along +Y); pick the axis that matches the
object's natural "forward". `up-node` optionally references a node that fixes the
roll about the aim direction when the default up would be ambiguous.

**Related.** Pairs with the sk-target-at support node (a movable,
optionally visualized look-at point) and its class TargetAt. Sibling
constraints in the Constraint family include
sk-orbit-constraint (revolve around a pivot) and
sk-align-to-spline-constraint (follow a path); the GPU-parallel
sk-target-at-point-constraint aims *every* clone of a Cloner at a
shared target at once.

<a id="example"></a>

## Example

```sk
<!-- Orients the host node so its chosen axis points at a target node (by id). -->
<sk-scene>
    <sk-plain-material id="mat" base-color="#7fa8d8"></sk-plain-material>

    <!-- The target to look at -->
    <sk-sphere id="target" x="4" radius="0.5" segments="6">
        <sk-surface-paint material="#mat"></sk-surface-paint>
    </sk-sphere>

    <!-- An arrow that keeps pointing at the target -->
    <sk-arrow shaft-length="1.5">
        <sk-surface-paint material="#mat"></sk-surface-paint>
        <sk-target-at-constraint target="#target" axis="+y"></sk-target-at-constraint>
    </sk-arrow>
</sk-scene>
```

<a id="attr-target"></a>

## target

Type: `<id-ref>` · Required: no · Animatable: yes

The look-at reference: the TargetAt whose position the

Related: [`type:id-ref`](types/id-ref.md)

<a id="attr-up-node"></a>

## up-node

Type: `<id-ref>` · Required: no · Animatable: yes

Node whose Y-axis is used as the up reference for orientation

Related: [`type:id-ref`](types/id-ref.md)

<a id="attr-axis"></a>

## axis

Type: `<orientation-axis>` · Required: no · Animatable: yes · Default: `"+z"`

The axis of the target node that should point at the look-at position.

Related: [`type:orientation-axis`](types/orientation-axis.md)

---

Related records: [`type:id-ref`](types/id-ref.md), [`type:orientation-axis`](types/orientation-axis.md)
