Generates a collision when the attachment point on a RigidBody moves past a certain point on a path so that the RigidBody cannot move past that point. The RigidBody would typically be connected to the path with a PathJoint, and so can move along the path.

Implementation Notes

The current position of the body determines where on the path we detect the body is, and this is stored in a PathPoint. We do a global search over the entire path here for the closest point on the path to the attachment point, see NumericalPath.findNearestGlobal, whereas later on we do a local search starting at the current PathPoint position, see NumericalPath.findNearestLocal.

NOTE: Does not deal with case where the body crosses the 'stitch' point in a closed loop path.

Hierarchy (view full)

Implements

Constructors

  • Parameters

    • name: string

      the name of this SimObject

    • path: NumericalPath

      the path to connect

    • body: RigidBody

      the RigidBody to connect

    • attach_body: Vector

      the attachment point on the RigidBody in body coordinates

    • limit: number

      the limiting value of the path position, p, when the body moves beyond this then a collision is created.

    • upperLimit: boolean

      true means this is an is an upper limit; false indicates this is a lower limit

    Returns PathEndPoint

Properties

attach_body_: Vector

attachment point in body coords of this.body_

limit_: number

the limiting value of the path position, p, when the body moves beyond this then a collision is created.

path that joint is attached to

ppt_: PathPoint

current position along the path

ppt_old_: PathPoint

last position along the path

upperLimit_: boolean

true means this is an is an upper limit; false indicates this is a lower limit.

ID: number = 1

Counter used for naming SimObjects.

Methods

  • Adds RigidBodyCollisions for this Connector to an array of collisions.

    Parameters

    • collisions: RigidBodyCollision[]

      the array of collisions to which to add the RigidBodyCollision for this Connector.

    • time: number

      simulation time when this collision is detected

    • _accuracy: number

      distance accuracy: how close we must be to the point of collision in order to be able to handle it.

    Returns void

  • Aligns the RigidBodys connected by this Connector. See the documentation for the particular Connector for how the alignment is done.

    Returns void

  • Name of this SimObject, either the language-independent name for scripting purposes or the localized name for display to user.

    The language-independent name should be the same as the English version but capitalized and with spaces and dashes replaced by underscore, see Util.toName, nameEquals.

    The name should give an idea of the role of the SimObject in the simulation. This allows us to to treat an object in a special way depending on its name. For example, we might use the name to decide what type of DisplayObject to create to represent the SimObject.

    Parameters

    • Optional opt_localized: boolean

      true means return the localized version of the name; default is false which means return the language independent name.

    Returns string

    name of this SimObject

  • Returns the distance between attachment points of the bodies in the direction of the normal vector. This is equal to the dot product of the normal vector and the vector between the two attachment points.

    Returns number

    normal distance between attachment points of the bodies

  • Returns true if the given SimObject is similar to this SimObject for display purposes. SimObjects are similar when they are the same type and nearly the same size and location. Mainly used when showing forces - to avoid adding too many objects to the display. See SimList.getSimilar.

    Parameters

    • obj: SimObject

      the SimObject to compare to

    • Optional _opt_tolerance: number

      the amount the object components can differ by

    Returns boolean

    true if this SimObject is similar to obj for display purposes

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:

    DisplayShape{polygon:Polygon{'chain3'}}
    

    Returns string

    a minimal string representation of this object.

Generated using TypeDoc