Options
All
  • Public
  • Public/Protected
  • All
Menu

Creates a HingeConstraint, which is a type of PhysicsConstraint.

param pivotA

The first pivot point, in world space.

param pivotB

The second pivot point, in world space.

param scene

The scene the constraint is used in.

returns

The new HingeConstraint.

This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint. This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.

Hierarchy

Index

Constructors

Properties

_pluginData: any

V2 Physics plugin private data for a physics material

Methods

  • dispose(): void
  • Disposes the constraint from the physics engine.

    This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.

    Returns void

  • getAxisFriction(axis: ConstraintAxis): number
  • Gets the friction of the given axis of the physics engine.

    Parameters

    • axis: ConstraintAxis

      The axis of the physics engine.

    Returns number

    The friction of the given axis.

  • getAxisMaxLimit(axis: ConstraintAxis): number
  • Gets the maximum limit of the given axis of the physics engine.

    Parameters

    • axis: ConstraintAxis

      The axis of the physics engine.

    Returns number

    The maximum limit of the given axis.

  • getAxisMinLimit(axis: ConstraintAxis): number
  • Gets the minimum limit of the given axis of the physics engine.

    Parameters

    • axis: ConstraintAxis

      The axis of the physics engine.

    Returns number

    The minimum limit of the given axis.

  • getAxisMode(axis: ConstraintAxis): ConstraintAxisLimitMode
  • Gets the limit mode of the given axis of the constraint.

    Parameters

    • axis: ConstraintAxis

      The axis of the constraint.

    Returns ConstraintAxisLimitMode

    The limit mode of the given axis.

  • getAxisMotorMaxForce(axis: ConstraintAxis): number
  • Gets the maximum force of the motor of the given axis of the constraint.

    Parameters

    • axis: ConstraintAxis

      The axis of the constraint.

    Returns number

    The maximum force of the motor.

  • getAxisMotorTarget(axis: ConstraintAxis): number
  • Gets the target velocity of the motor associated to the given constraint axis.

    Parameters

    • axis: ConstraintAxis

      The constraint axis associated to the motor.

    Returns number

    The target velocity of the motor.

  • getAxisMotorType(axis: ConstraintAxis): ConstraintMotorType
  • Gets the motor type of the specified axis of the constraint.

    Parameters

    • axis: ConstraintAxis

      The axis of the constraint.

    Returns ConstraintMotorType

    The motor type of the specified axis.

  • getCollisionsEnabled(): boolean
  • Gets whether collisions are enabled for this physics object.

    Returns boolean

    true if collisions are enabled, false otherwise.

  • getEnabled(): boolean
  • getOptions(): PhysicsConstraintParameters
  • Retrieves the options of the physics constraint.

    Returns PhysicsConstraintParameters

    The physics constraint parameters.

  • getType(): ConstraintType
  • Gets the type of the constraint.

    Returns ConstraintType

    The type of the constraint.

  • setAxisFriction(axis: ConstraintAxis, friction: number): void
  • Sets the friction of the given axis of the physics engine.

    Parameters

    • axis: ConstraintAxis

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

    • friction: number

      The friction to set for the given axis.

    Returns void

  • setAxisMaxLimit(axis: ConstraintAxis, limit: number): void
  • Sets the maximum limit of the given axis for the physics engine.

    Parameters

    • axis: ConstraintAxis

      The axis to set the limit for.

    • limit: number

      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.

    Returns void

  • setAxisMinLimit(axis: ConstraintAxis, minLimit: number): void
  • Sets the minimum limit of a given axis of a constraint.

    Parameters

    • axis: ConstraintAxis

      The axis of the constraint.

    • minLimit: number

      The minimum limit of the axis.

    Returns void

  • setAxisMode(axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void
  • Sets the limit mode for the given axis of the constraint.

    Parameters

    • axis: ConstraintAxis

      The axis to set the limit mode for.

    • limitMode: ConstraintAxisLimitMode

      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.

    Returns void

  • setAxisMotorMaxForce(axis: ConstraintAxis, maxForce: number): void
  • Sets the maximum force of the motor of the given axis of the constraint.

    Parameters

    • axis: ConstraintAxis

      The axis of the constraint.

    • maxForce: number

      The maximum force of the motor.

    Returns void

  • setAxisMotorTarget(axis: ConstraintAxis, target: number): void
  • Sets the target velocity of the motor associated with the given axis of the constraint.

    Parameters

    • axis: ConstraintAxis

      The axis of the constraint.

    • target: number

      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.

    Returns void

  • setAxisMotorType(axis: ConstraintAxis, motorType: ConstraintMotorType): void
  • Sets the motor type of the given axis of the constraint.

    Parameters

    • axis: ConstraintAxis

      The axis of the constraint.

    • motorType: ConstraintMotorType

      The type of motor to use.

    Returns void

    void

  • setCollisionsEnabled(isEnabled: boolean): void
  • Enables or disables collisions for the physics engine.

    Parameters

    • isEnabled: boolean

      A boolean value indicating whether collisions should be enabled or disabled.

    Returns void

  • setEnabled(isEnabled: boolean): void
  • Enable/disable the constraint

    Parameters

    • isEnabled: boolean

      value for the constraint

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme