UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

39 lines (38 loc) 1.33 kB
import { Behaviour } from "./Component.js"; /** * The [AlignmentConstraint](https://engine.needle.tools/docs/api/AlignmentConstraint) positions and scales this GameObject to span between two target objects. * The object is rotated to face `to` and scaled along Z to match the distance. * * **Use cases:** * - Dynamic beams or laser effects between objects * - Stretchy connectors or ropes * - Visual links between UI elements * - Debug lines between transforms * * **How it works:** * - Position: Centered between `from` and `to` (or at `from` if not centered) * - Rotation: Looks at `to` from `from` * - Scale: Z-axis scales to match distance, X/Y use `width` * * @example Create a beam between two objects * ```ts * const beam = beamMesh.addComponent(AlignmentConstraint); * // Set targets via serialized properties in editor * // or via code if properties are exposed * ``` * * @summary Aligns and scales object between two targets * @category Constraints * @group Components * @see {@link LookAtConstraint} for rotation-only constraints * @see {@link SmoothFollow} for following with smoothing **/ export declare class AlignmentConstraint extends Behaviour { private from; private to; private width; private centered; private _centerPos; awake(): void; update(): void; }