TargetAtPointConstraint

← prev index next →

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.

Remarks

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.

Constructor

constructor(config?: { target: SceneNode | string; axis?: AxisOrientation; upReference?: SceneNode | string | null; field?: Field | null; fieldWeightRange?: readonly [number, number] })

Properties

Config Properties

PropertyTypeDefaultDescriptionDeclared by
targetanimatableread-only SceneNode | string The target host this modifier applies to, or null before PointConstraint
axisanimatable AxisOrientation "+z" Which local axis of each clone points at the target. TargetAtPointConstraint
upReferenceanimatable SceneNode | string | null The node whose Y-axis is used as the up reference, or null for world Y-up. TargetAtPointConstraint
fieldanimatableread-only Field | null The field used by this point constraint, if any. PointConstraint
fieldWeightRangeanimatable readonly [number, number] The [lo, hi] range the normalized field weight maps onto. PointConstraint

Other Properties

PropertyTypeDefaultDescriptionDeclared by
pointToNode SceneNode The node that clones orient toward. TargetAtPointConstraint
sceneread-only any Gets the Scene this animatable belongs to, if any. SkenraAnimatable
animationsread-only SkenraAnimation[] Public getter for the animations affecting this target. SkenraAnimatable

Methods

MethodDescriptionDeclared by
animate(firstArg: TypedKeyframe<this>[] | TypedPropertyIndexedKeyframes<this> | Record<string, any> | globalThis.Keyframe[] | globalThis.PropertyIndexedKeyframes | null, secondArg?: number | KeyframeAnimationOptions | globalThis.KeyframeAnimationOptions): SkenraAnimation & Animation Creates a new SkenraAnimation for this target per Web Animations API. SkenraAnimatable
removeAnimation(animation: SkenraAnimation): boolean Removes a specific animation from this object. SkenraAnimatable
constrain(type: K, config: ConstraintConfigMap[K]): ConstraintReturnMap[K] Creates a constraint on this Animatable using a fluent API. SkenraAnimatable

Example

const modifier = new TargetAtPointConstraint({
    target: targetNode,
    axis: '+z',
    upReference: upNode,
});
cloner.addPointConstraint(modifier);