Library constraint

Constraint library.

Functions

findConstraintEntity( entity, type ) Returns the first matching entity that is constrained to this one by the given constraint type.
getAllConstrainedEntities( entity, filter ) Gets a table of all constrained entities, including those constrained indirectly through other entities.
getConstrainedEntities( entity ) Gets all constrained entities directly constrained to the given entity.
hasConstraints( entity ) Returns whether the given entity has any constraints.
noCollide( entity1, entity2, bone1, bone2 ) Creates a no-collide constraint between two entities.
removeAll( entity ) Removes all constraints from the given entity, regardless of type.
removeConstraints( entity, type ) Removes all constraints of the given type from the given entity.
weld( entity1, entity2, bone1, bone2, forceLimit, noCollide, deleteEnt1OnBreak ) Creates a weld constraint between two entities.


Functions

constraint.findConstraintEntity( entity, type )
Returns the first matching entity that is constrained to this one by the given constraint type.

Environment:

Server

Parameters:

  • (Entity) entity: The entity to get the constrained entity for.
  • (string) type: The type of constraint, e.g. "Weld", "NoCollide".
constraint.getAllConstrainedEntities( entity, filter )
Gets a table of all constrained entities, including those constrained indirectly through other entities.

Environment:

Server

Parameters:

  • (Entity) entity: The entity to get constrained entities for.
  • (function?) filter: (Optional) Filter function, return true to keep the entity, false to discard it.

Return value:

    (table) An array of all entities that are constrained and passed the filter if it was provided.
constraint.getConstrainedEntities( entity )
Gets all constrained entities directly constrained to the given entity. This is not recursive.

Environment:

Server

Parameters:

  • (Entity) entity: The entity to get constrained entities for.

Return value:

    (table) An array of all entities that are directly constrained to the provided entity.
constraint.hasConstraints( entity )
Returns whether the given entity has any constraints.

Environment:

Server

Parameters:

  • (Entity) entity: The entity to check for constraints.

Return value:

    (boolean) True if the entity is constrained to at least one other entity, false otherwise.
constraint.noCollide( entity1, entity2, bone1, bone2 )
Creates a no-collide constraint between two entities.

Environment:

Server

Parameters:

  • (Entity) entity1: First entity.
  • (Entity) entity2: Second entity.
  • (number?) bone1: Bone on the first entity, defaults to 0.
  • (number?) bone2: Bone on the second entity, defaults to 0.
constraint.removeAll( entity )
Removes all constraints from the given entity, regardless of type.

Environment:

Server

Parameters:

  • (Entity) entity: The entity to remove constraints from.
constraint.removeConstraints( entity, type )
Removes all constraints of the given type from the given entity.

Environment:

Server

Parameters:

  • (Entity) entity: The entity to remove constraints from.
  • (string) type: The type of constraint to remove, e.g. "Weld", "NoCollide".
constraint.weld( entity1, entity2, bone1, bone2, forceLimit, noCollide, deleteEnt1OnBreak )
Creates a weld constraint between two entities.

Environment:

Server

Parameters:

  • (Entity) entity1: First entity.
  • (Entity) entity2: Second entity.
  • (number?) bone1: Bone on the first entity, defaults to 0.
  • (number?) bone2: Bone on the second entity, defaults to 0.
  • (number?) forceLimit: Limit on the weld before it breaks, default is 0 (no limit).
  • (boolean?) noCollide: Whether to make the weld ignore collisions between the two entities.
  • (boolean?) deleteEnt1OnBreak: Sets whether to delete the first entity when the weld breaks.

Valid XHTML 1.0!