Creates a SpringConstraint, which is a type of SixDofConstraint. This constraint applies a force at the ends which is proportional to the distance between ends, and a stiffness and damping factor. The force is calculated as (stiffness * positionError) - (damping * velocity)

This constraint applies a force at the ends which is proportional to the distance between ends, and a stiffness and damping factor.

lock

three/Object3D/**

Hierarchy (view full)

Accessors

Constructors

Methods

Properties - AxisFriction

Properties - Behavior

Properties - Other

Properties - axisMaxLimit

Properties - axisMinLimit

Properties - axisMotorMaxForce

Properties - axisMotorTargetVelocity

Properties - axisMotorType

Properties - setAxisMode

Accessors

  • get disposed(): boolean
  • Gets the disposed status of the entity.

    Returns boolean

    The disposed status.

Constructors

Methods

  • Get the instance of the ZComponent that constructed this entity.

    If you pass the class of a ZComponent as the type parameter, this function will ensure that it returns an instance of that ZComponent. If this component or behavior was constructed by a different ZComponent class, or by a different entity altogether, the function with throw an error.

    Type Parameters

    • T extends ZComponent<any, T> = ZComponent<any>

    Parameters

    • Optionaltype: ConstructorForComponent<T>

      The ZComponent class that you are expecting to receive

    Returns T

    The instance of the ZComponent that constructed this component or behavior

  • Register a function to be called when an Event is fired, or an Observable's value changes. The function will only be bound to the underlying Event or Observable while this entity is enabled.

    Using this function, rather than attaching your handler directly to the Event or Observable, ensures your handler is automatically released when this entity is disposed.

    Type Parameters

    • Args extends any[]

    Parameters

    • evt: Event<Args>

      The Event or Observable to listen to

    • fn: ((...args: Args) => void)

      A function that will be called when the event fires, or the Observable value changes

        • (...args): void
        • Parameters

          Returns void

    • Optionalpriority: number

    Returns any

  • Type Parameters

    • Args extends any[]

    Parameters

    Returns any

  • Type Parameters

    • Type

    Parameters

    • observable: Observable<Type, never>
    • fn: ((v: Type) => void)
        • (v): void
        • Parameters

          Returns void

    • Optionalpriority: number

    Returns any

  • Type Parameters

    • Type

    Parameters

    Returns any

  • Unregisters a function that was previously registered to an Event or Observable.

    Type Parameters

    • Args extends any[]

    Parameters

    • evt: Event<Args>

      The Event or Observable

    • fn: ((...args: Args) => void)

      The function that was passed in the call to register

        • (...args): void
        • Parameters

          Returns void

    Returns any

  • Type Parameters

    • Type

    Parameters

    • observable: Observable<Type, never>
    • fn: ((v: Type) => void)
        • (v): void
        • Parameters

          Returns void

    Returns any

Properties - AxisFriction

axisFriction: Observable<[axis: PhysicsConstraintAxis, friction: number], never> = ...

Sets the friction of the given axis of the physics engine.

The axis of the physics engine to set the friction for.

The friction to set for the given axis.

[LinearX, 0.5]

Properties - Behavior

enabled: Observable<boolean, never>

If false, this entity and its children will no longer participate in the experience.

Note - to read this value, you may wish to use enabledResolved which will be false if this entity, or any of its parents, have enabled set to false.

The precise implications of enabled being false will vary between entities, but in general disabled entities:

  • should not emit any events,
  • should not take any action, e.g. navigate the user to a different page,
  • should not perform any network communication,
  • should not make changes to other behaviors or components in the experience,
  • should minimise any runtime performance cost (e.g. detach from any frame handlers).

true

10

Properties - Other

_context: HavokContext = ...
childBody?: RigidBodyBehavior
constraintid: HP_ConstraintId
contextManager: ContextManager
dirtyFlags: {
    axisFriction: boolean;
    axisMaxLimit: boolean;
    axisMinLimit: boolean;
    axisMode: boolean;
    axisMotorMaxForce: boolean;
    axisMotorTarget: boolean;
    axisMotorType: boolean;
} = ...
enabledResolved: Observable<boolean, never>

This will have value false if this entity, or any of its parents, have enabled set to false.

To change the enabled status of this entity, use the enabled property instead.

The precise implications of enabled being false will vary between entities, but in general disabled entities:

  • should not emit any events,
  • should not take any action, e.g. navigate the user to a different page,
  • should not perform any network communication,
  • should not make changes to other behaviors or components in the experience,
  • should minimise any runtime performance cost.

Disabled entities will typically remain visible (if they have a visible appearance).

instance: Component<any, ConstructorProps>

The collection of limits which this constraint will apply

onDispose: Event<[]>

An event that is fired as the last act of this entity being destroyed.

options: _Options = {}

Properties - axisMaxLimit

axisMaxLimit: Observable<[axis: PhysicsConstraintAxis, maxLimit: number], never> = ...

Sets the maximum limit of the given axis for the physics engine.

The axis to set the limit for.

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.

[LinearX, 0]

Properties - axisMinLimit

axisMinLimit: Observable<[axis: PhysicsConstraintAxis, minLimit: number], never> = ...

Sets the minimum limit of a given axis of a constraint.

The axis of the constraint.

The minimum limit of the axis.

[LinearX, 0]

Properties - axisMotorMaxForce

axisMotorMaxForce: Observable<[axis: PhysicsConstraintAxis, maxForce: number], never> = ...

Sets the maximum force of the motor of the given axis of the constraint.

The axis of the constraint.

The maximum force of the motor.

[LinearX, 0]

Properties - axisMotorTargetVelocity

axisMotorTarget: Observable<[axis: PhysicsConstraintAxis, target: number], never> = ...

Sets the target velocity of the motor associated with the given axis of the constraint.

The axis of the constraint.

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.

[LinearX, 0]

Properties - axisMotorType

axisMotorType: Observable<[axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType], never> = ...

Sets the motor type of the given axis of the constraint.

The axis of the constraint.

The type of motor to use.

void

[LinearX, None]

Properties - setAxisMode

axisMode: Observable<[axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode], never> = ...

Sets the limit mode for the given axis of the constraint.

The axis to set the limit mode for.

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.

[LinearX, Free]