Class SpringConstraint
Hierarchy (View Summary)
- Physics6DoFConstraint
- SpringConstraint
Properties
_ plugin Data
V2 Physics plugin private data for a physics material
limits
The collection of limits which this constraint will apply
Accessors
is Collisions Enabled
-
get isCollisionsEnabled(): boolean
Gets whether collisions are enabled for this physics object.
Returns boolean
trueif collisions are enabled,falseotherwise. -
set isCollisionsEnabled(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
- isEnabled: boolean
is Enabled
-
get isEnabled(): boolean
Returns boolean
true if constraint is enabled
-
set isEnabled(isEnabled: boolean): void
Enable/disable the constraint
Parameters
- isEnabled: boolean
value for the constraint
Returns void
- isEnabled: boolean
options
-
Retrieves the options of the physics constraint.
Returns PhysicsConstraintParameters
The physics constraint parameters.
type
Methods
dispose
-
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
get Axis Friction
-
Gets the friction of the given axis of the physics engine.
Parameters
- axis: PhysicsConstraintAxis
The axis of the physics engine.
Returns Nullable<number>
The friction of the given axis, or null if the constraint hasn't been initialized yet.
- axis: PhysicsConstraintAxis
get Axis Max Limit
-
Gets the maximum limit of the given axis of the physics engine.
Parameters
- axis: PhysicsConstraintAxis
The axis of the physics engine.
Returns Nullable<number>
The maximum limit of the given axis, or null if the constraint hasn't been initialized yet.
- axis: PhysicsConstraintAxis
get Axis Min Limit
-
Gets the minimum limit of the given axis of the physics engine.
Parameters
- axis: PhysicsConstraintAxis
The axis of the physics engine.
Returns Nullable<number>
The minimum limit of the given axis, or null if the constraint hasn't been initialized yet.
- axis: PhysicsConstraintAxis
get Axis Mode
-
Gets the limit mode of the given axis of the constraint.
Parameters
- axis: PhysicsConstraintAxis
The axis of the constraint.
Returns Nullable<PhysicsConstraintAxisLimitMode>
The limit mode of the given axis, or null if the constraint hasn't been initialized yet.
- axis: PhysicsConstraintAxis
get Axis Motor Max Force
-
Gets the maximum force of the motor of the given axis of the constraint.
Parameters
- axis: PhysicsConstraintAxis
The axis of the constraint.
Returns Nullable<number>
The maximum force of the motor, or null if the constraint hasn't been initialized yet.
- axis: PhysicsConstraintAxis
get Axis Motor Target
-
Gets the target velocity of the motor associated to the given constraint axis.
Parameters
- axis: PhysicsConstraintAxis
The constraint axis associated to the motor.
Returns Nullable<number>
The target velocity of the motor, or null if the constraint hasn't been initialized yet.
- axis: PhysicsConstraintAxis
get Axis Motor Type
-
Gets the motor type of the specified axis of the constraint.
Parameters
- axis: PhysicsConstraintAxis
The axis of the constraint.
Returns Nullable<PhysicsConstraintMotorType>
The motor type of the specified axis, or null if the constraint hasn't been initialized yet.
- axis: PhysicsConstraintAxis
get Bodies Using Constraint
-
Gets all bodies that are using this constraint
Returns ConstrainedBodyPair[]
set Axis Friction
-
Sets the friction of the given axis of the physics engine.
Parameters
- axis: PhysicsConstraintAxis
The axis of the physics engine to set the friction for.
- friction: number
The friction to set for the given axis.
Returns void
- axis: PhysicsConstraintAxis
set Axis Max Limit
-
Sets the maximum limit of the given axis for the physics engine.
Parameters
- axis: PhysicsConstraintAxis
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
- axis: PhysicsConstraintAxis
set Axis Min Limit
-
Sets the minimum limit of a given axis of a constraint.
Parameters
- axis: PhysicsConstraintAxis
The axis of the constraint.
- minLimit: number
The minimum limit of the axis.
Returns void
- axis: PhysicsConstraintAxis
set Axis Mode
-
Sets the limit mode for the given axis of the constraint.
Parameters
- axis: PhysicsConstraintAxis
The axis to set the limit mode for.
- limitMode: PhysicsConstraintAxisLimitMode
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
- axis: PhysicsConstraintAxis
set Axis Motor Max Force
-
Sets the maximum force of the motor of the given axis of the constraint.
Parameters
- axis: PhysicsConstraintAxis
The axis of the constraint.
- maxForce: number
The maximum force of the motor.
Returns void
- axis: PhysicsConstraintAxis
set Axis Motor Target
-
Sets the target velocity of the motor associated with the given axis of the constraint.
Parameters
- axis: PhysicsConstraintAxis
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
- axis: PhysicsConstraintAxis
set Axis Motor Type
-
Sets the motor type of the given axis of the constraint.
Parameters
- axis: PhysicsConstraintAxis
The axis of the constraint.
- motorType: PhysicsConstraintMotorType
The type of motor to use.
Returns void
- axis: PhysicsConstraintAxis
Creates a SpringConstraint, which is a type of Physics6DoFConstraint. 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)
Param: pivotA
The first pivot of the constraint in local space.
Param: pivotB
The second pivot of the constraint in local space.
Param: axisA
The first axis of the constraint in local space.
Param: axisB
The second axis of the constraint in local space.
Param: minDistance
The minimum distance between the two pivots.
Param: maxDistance
The maximum distance between the two pivots.
Param: stiffness
The stiffness of the spring.
Param: damping
The damping of the spring.
Param: scene
The scene the constraint belongs to.
Returns
The created SpringConstraint.