import { Component, ContextManager, Observable } from '@zcomponent/core'; import { PhysicsConstraintAxis, PhysicsConstraintAxisLimitMode, PhysicsConstraintMotorType } from '../../IPhysics'; import { PhysicsConstraint, PhysicsConstraintBaseConstructorProps } from './PhysicsConstraint'; interface SixDOFConstructorProps extends PhysicsConstraintBaseConstructorProps { limits: Physics6DoFLimit[]; } export interface Physics6DoFLimit { /** * The axis ID to limit */ axis: PhysicsConstraintAxis; /** * An optional minimum limit for the axis. * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes. */ minLimit?: number; /** * An optional maximum limit for the axis. * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes. */ maxLimit?: number; /** * The stiffness of the constraint. */ stiffness?: number; /** * A constraint parameter that specifies damping. */ damping?: number; } export declare class PhysicsSixDofLimit { opts: Physics6DoFLimit; constructor(opts: Physics6DoFLimit); } /** * A generic constraint, which can be used to build more complex constraints than those specified * in PhysicsConstraintType. The axis and pivot options in PhysicsConstraintParameters define the space * the constraint operates in. This constraint contains a set of limits, which restrict the * relative movement of the bodies in that coordinate system * * @zgroup Physics Constraints * @zicon lock * @zparents three/Object3D/** * @zgroup Physics Constraints */ export declare class SixDofConstraint extends PhysicsConstraint { constructor(contextManager: ContextManager, instance: Component, props: SixDOFConstructorProps); dirtyFlags: { axisFriction: boolean; axisMode: boolean; axisMinLimit: boolean; axisMaxLimit: boolean; axisMotorType: boolean; axisMotorTarget: boolean; axisMotorMaxForce: boolean; }; /** * The collection of limits which this constraint will apply */ limits: Physics6DoFLimit[]; /** * Sets the friction of the given axis of the physics engine. * @param axis - The axis of the physics engine to set the friction for. * @param friction - The friction to set for the given axis. * * @zprop * @zgroup AxisFriction * @zdefault [LinearX, 0.5] */ axisFriction: Observable<[axis: PhysicsConstraintAxis, friction: number], never>; /** * Sets the limit mode for the given axis of the constraint. * @param axis The axis to set the limit mode for. * @param limitMode The limit mode to set. * * This method is useful for setting the limit mode for a given axis of the constraint. This is important for * controlling the behavior of the physics engine when the constraint is reached. By setting the limit mode, * the engine can be configured to either stop the motion of the objects, or to allow them to continue * moving beyond the constraint. * @zprop * @zgroup setAxisMode * @zdefault [LinearX, Free] */ axisMode: Observable<[axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode], never>; /** * Sets the minimum limit of a given axis of a constraint. * @param axis - The axis of the constraint. * @param minLimit - The minimum limit of the axis. * @zprop * @zgroup axisMinLimit * @zdefault [LinearX, 0] */ axisMinLimit: Observable<[axis: PhysicsConstraintAxis, minLimit: number], never>; /** * Sets the maximum limit of the given axis for the physics engine. * @param axis - The axis to set the limit for. * @param limit - The maximum limit of the axis. * * This method is useful for setting the maximum limit of the given axis for the physics engine, * which can be used to control the movement of the physics object. This helps to ensure that the * physics object does not move beyond the given limit. * * @zprop * @zgroup axisMaxLimit * @zdefault [LinearX, 0] */ axisMaxLimit: Observable<[axis: PhysicsConstraintAxis, maxLimit: number], never>; /** * Sets the motor type of the given axis of the constraint. * @param axis - The axis of the constraint. * @param motorType - The type of motor to use. * @returns void * @zprop * @zgroup axisMotorType * @zdefault [LinearX, None] */ axisMotorType: Observable<[axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType], never>; /** * Sets the target velocity of the motor associated with the given axis of the constraint. * @param axis - The axis of the constraint. * @param target - The target velocity of the motor. * * This method is useful for setting the target velocity of the motor associated with the given axis of the constraint. * @zprop * @zgroup axisMotorTargetVelocity * @zdefault [LinearX, 0] */ axisMotorTarget: Observable<[axis: PhysicsConstraintAxis, target: number], never>; /** * Sets the maximum force of the motor of the given axis of the constraint. * @param axis - The axis of the constraint. * @param maxForce - The maximum force of the motor. * @zprop * @zgroup axisMotorMaxForce * @zdefault [LinearX, 0] */ axisMotorMaxForce: Observable<[axis: PhysicsConstraintAxis, maxForce: number], never>; } export {};