import { Component, ContextManager, Behavior, BehaviorConstructorProps } from '@zcomponent/core'; import { PhysicsConstraintType } from '../../IPhysics'; import { HavokContext } from '../../contexts/HavokContext'; import { HP_ConstraintId } from '@babylonjs/havok'; import { RigidBodyBehavior } from '../../components/IRigidBody'; import { RigidBody } from '../RigidBody'; import * as THREE from 'three'; interface _Options { /** * Location of the constraint pivot in the space of first body */ pivotA?: THREE.Vector3; /** * Location of the constraint pivot in the space of the second body */ pivotB?: THREE.Vector3; /** * An axis in the space of the first body which determines how * distances/angles are measured for LINEAR_X/ANGULAR_X limits. */ axisA?: THREE.Vector3; /** * An axis in the space of the second body which determines how * distances/angles are measured for LINEAR_X/ANGULAR_X limits. */ axisB?: THREE.Vector3; /** * An axis in the space of the first body which determines how * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits. */ perpAxisA?: THREE.Vector3; /** * An axis in the space of the second body which determines how * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits. */ perpAxisB?: THREE.Vector3; /** * The maximum distance that can seperate the two pivots. * Only used for DISTANCE constraints */ maxDistance?: number; /** * Determines if the connected bodies should collide. Generally, * it is preferable to set this to false, especially if the constraint * positions the bodies so that they overlap. Otherwise, the constraint * will "fight" the collision detection and may cause jitter. */ collision?: boolean; } export interface PhysicsConstraintBaseConstructorProps extends BehaviorConstructorProps { /** * @zprop * @zvalues behaviorids three/Object3D/Physics/RigidBody */ parentRigidbody?: string; /** * */ parentRigidBodyBehavior?: RigidBody; } export interface PhysicsConstraintConstructorProps extends PhysicsConstraintBaseConstructorProps { /** * Location of the constraint pivot in the space of first body */ pivotA?: [number, number, number]; /** * Location of the constraint pivot in the space of the second body */ pivotB?: [number, number, number]; /** * An axis in the space of the first body which determines how * distances/angles are measured for LINEAR_X/ANGULAR_X limits. */ axisA?: [number, number, number]; /** * An axis in the space of the second body which determines how * distances/angles are measured for LINEAR_X/ANGULAR_X limits. */ axisB?: [number, number, number]; /** * An axis in the space of the first body which determines how * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits. */ perpAxisA?: [number, number, number]; /** * An axis in the space of the second body which determines how * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits. */ perpAxisB?: [number, number, number]; /** * The maximum distance that can seperate the two pivots. * Only used for DISTANCE constraints */ maxDistance?: number; /** * Determines if the connected bodies should collide. Generally, * it is preferable to set this to false, especially if the constraint * positions the bodies so that they overlap. Otherwise, the constraint * will "fight" the collision detection and may cause jitter. */ collision?: boolean; type: PhysicsConstraintType; } export declare class PhysicsConstraint extends Behavior { constructorProps: PhysicsConstraintConstructorProps; readonly _context: HavokContext; options: _Options; constraintid: HP_ConstraintId; body?: RigidBodyBehavior; private helpers; childBody?: RigidBodyBehavior; constructor(contextManager: ContextManager, instance: Component, constructorProps: PhysicsConstraintConstructorProps); /** * Should only be called once both bodies are ready. */ init(): void; dispose: () => never; onStart: () => void; onStop: () => void; private createHelpers; } export {};