@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.
45 lines (44 loc) • 1.64 kB
TypeScript
import { Behaviour } from "./Component.js";
/**
* The [OffsetConstraint](https://engine.needle.tools/docs/api/OffsetConstraint) maintains a fixed positional and rotational offset relative to a target object.
* Useful for attaching objects to moving targets while preserving a specific spatial relationship.
*
* **Use cases:**
* - Camera following a player with offset
* - UI elements attached to characters
* - Weapons attached to hands
* - Objects orbiting around a target
*
* **Options:**
* - `affectPosition` - Apply position offset
* - `affectRotation` - Apply rotation offset
* - `alignLookDirection` - Make object face same direction as target
* - `levelLookDirection` - Keep look direction horizontal (ignore pitch)
* - `levelPosition` - Project position onto horizontal plane
* - `referenceSpace` - Transform offset in this object's coordinate space
*
* @example Attach camera offset to player
* ```ts
* const constraint = camera.addComponent(OffsetConstraint);
* // Configure via serialized properties in editor
* ```
*
* @summary Maintains positional/rotational offset relative to target
* @category Constraints
* @group Components
* @see {@link SmoothFollow} for smoothed following
* @see {@link AlignmentConstraint} for alignment between two objects
*/
export declare class OffsetConstraint extends Behaviour {
private referenceSpace;
private from;
private affectPosition;
private affectRotation;
private alignLookDirection;
private levelLookDirection;
private levelPosition;
private positionOffset;
private rotationOffset;
private offset;
update(): void;
}