Aims every clone of a cloner at one shared target node, turning a chosen local axis to face it — the way to make a whole field of objects track a moving point.
JavaScript API:
TargetAtPointConstraint
This is the aiming member of the PointConstraint family: like every
point-constraint it runs a GPU
kernel over all of its host's points at once, so thousands of clones can look-at
the same target for the cost of one. It is the many-at-once counterpart of
sk-target-at-constraint, which aims a single node. Because it only rotates
(it moves no positions), it applies to a sk-cloner's clones; on a mesh or
spline host, whose output carries positions but no per-vertex orientation, it has
nothing to write and is skipped.
Key attributes. target names the node every clone aims at, by #id; its
world position is shared across all clones, so animating the target sweeps the
whole field. axis chooses which local axis of each clone points at the target
(any of the six signed axes, e.g. +y). Optionally, up-reference disambiguates
roll about that aim direction, and a field (by #id, a SpatialField)
with field-weight-range blends the look-at in by weight — weight 1 fully aims a
clone, weight 0 leaves its original rotation — so only part of the field turns.
Related. Its single-node CPU analogue is sk-target-at-constraint.
Sibling point-constraints include sk-simple-point-constraint (field-driven
translate/scale/rotate) and sk-radial-push-point-constraint.
Serve these docs to run the live example.
WebGPU needs a secure context — open this page via grunt serve
rather than double-clicking the file. The Markup tab works from disk.
<!-- Every clone in a grid of arrows aims its +Y axis at one shared hub node.
`target="#hub"` is the point they all face; `axis="+y"` picks which local
arrow axis does the aiming. Move the hub and the whole field re-aims. -->
<sk-scene>
<sk-directional-light p="52deg" h="23deg" intensity="1.0"></sk-directional-light>
<sk-ambient-light intensity="0.4"></sk-ambient-light>
<sk-plain-material id="hub-mat" base-color="#e0b040"></sk-plain-material>
<sk-plain-material id="arrow-mat" base-color="#7fa8d8"></sk-plain-material>
<!-- The target every clone aims at -->
<sk-sphere id="hub" radius="0.4">
<sk-surface-paint material="#hub-mat"></sk-surface-paint>
</sk-sphere>
<sk-cloner mode="vertex">
<sk-grid-points-source count-x="6" count-y="1" count-z="6"
spacing-x="2" spacing-y="2" spacing-z="2"></sk-grid-points-source>
<sk-arrow shaft-length="0.6">
<sk-surface-paint material="#arrow-mat"></sk-surface-paint>
</sk-arrow>
<sk-target-at-point-constraint target="#hub" axis="+y"></sk-target-at-point-constraint>
</sk-cloner>
</sk-scene>
| Attribute | Type | Default | Description |
|---|---|---|---|
targetanimatable |
<id-ref> |
— | The SceneNode that clones should orient toward. |
axisanimatable |
<orientation-axis> ("+x" | "-x" | "+y" | "-y" | "+z" | "-z") |
"+z" |
Which local axis of each clone should point at the target. |
up-referenceanimatable |
<id-ref> |
— | Optional node whose Y-axis is used as the up reference. reference by id |
field-weight-rangeanimatable |
<field-weight-range> ([<number>, <number>]) |
— | The [lo, hi] range the field weight maps onto. |
fieldanimatable |
<id-ref> |
— | Optional field that modulates the modifier's effect per-point. reference by id |