LimitDistanceConstraint - Verge3D User Manual - Soft8Soft
Description: Learn how to use LimitDistanceConstraint in your interactive 3D apps made with Verge3D

TargetConstraint →

# LimitDistanceConstraint

A constraint forces its owner to stay either further from, nearer to, or exactly at a given distance from its target.

To influence some object, push a LimitDistanceConstraint instance into the Object3D.constraints array.

## Constructor

### LimitDistanceConstraint(target : Object3D)

target — constraint's target object.

## Properties

See the base TargetConstraint class for inherited properties.

### # .distance : Float

The distance from target. Default is `0.0`.

### # .influence : Float

The percentage of influence the constraint has on the object. Default is `1.0` (100%).

### # .isLimitDistanceConstraint : Boolean

Used to check whether this or derived classes are limit distance constraints. Default is `true`.

### # .limitMode : String

Specifies the distance clamping mode. Default is `'LIMITDIST_ONSURFACE'`.

`"LIMITDIST_INSIDE"`
  The owner stays further from a given distance from its target.
`"LIMITDIST_OUTSIDE"`
  The owner stays nearer to a given distance from its target.
`"LIMITDIST_ONSURFACE"`
  The owner stays exactly at a given distance from its target.

### # .type : String

The constraint's type. Equals to `'LimitDistanceConstraint'`.

## Methods

See the base TargetConstraint class for inherited methods.

## Puzzles

You can use the limit transform puzzle to apply LimitDistanceConstraint in a visual manner.

## Source

For more info on how to obtain the source code of this module see this page.