Module org.dyn4j
Package org.dyn4j.dynamics.joint
Class AbstractSingleBodyJoint<T extends PhysicsBody>
- Object
-
- AbstractJoint<T>
-
- AbstractSingleBodyJoint<T>
-
- Type Parameters:
T
- thePhysicsBody
type
- All Implemented Interfaces:
DataContainer
,Joint<T>
,SingleBodyJoint<T>
,Shiftable
,Ownable
- Direct Known Subclasses:
PinJoint
public abstract class AbstractSingleBodyJoint<T extends PhysicsBody> extends AbstractJoint<T> implements SingleBodyJoint<T>, Joint<T>, Shiftable, DataContainer, Ownable
Represents an abstract implementation of constrained motion with a singlePhysicsBody
.- Since:
- 5.0.0
- Version:
- 5.0.0
- Author:
- William Bittle
-
-
Field Summary
Fields Modifier and Type Field Description protected T
body
The body-
Fields inherited from class AbstractJoint
bodies, collisionAllowed, owner, userData
-
Fields inherited from interface Joint
SPRING_MODE_FREQUENCY, SPRING_MODE_STIFFNESS
-
-
Constructor Summary
Constructors Constructor Description AbstractSingleBodyJoint(T body)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getBody()
Returns the body being constrained.T
getBody(int i)
Returns the body at the given index.int
getBodyCount()
Returns the number of bodies involved in this joint.boolean
isEnabled()
Returns true if thisJoint
is enabled.boolean
isMember(CollisionBody<?> body)
Returns true if the given body is a member of this joint.-
Methods inherited from class AbstractJoint
getBodies, getBodyIterator, getConstraintImpulseMixing, getErrorReductionParameter, getFrequency, getNaturalFrequency, getNaturalFrequency, getOwner, getSpringDampingCoefficient, getSpringStiffness, getUserData, isCollisionAllowed, setCollisionAllowed, setOwner, setUserData, toString
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface DataContainer
getUserData, setUserData
-
Methods inherited from interface Joint
getBodies, getBodyIterator, getReactionForce, getReactionTorque, initializeConstraints, isCollisionAllowed, setCollisionAllowed, solvePositionConstraints, solveVelocityConstraints
-
-
-
-
Field Detail
-
body
protected final T extends PhysicsBody body
The body
-
-
Constructor Detail
-
AbstractSingleBodyJoint
public AbstractSingleBodyJoint(T body)
Default constructor.- Parameters:
body
- the body- Throws:
NullPointerException
- if body is null
-
-
Method Detail
-
getBody
public final T getBody()
Description copied from interface:SingleBodyJoint
Returns the body being constrained.- Specified by:
getBody
in interfaceSingleBodyJoint<T extends PhysicsBody>
- Returns:
- T
-
getBodyCount
public final int getBodyCount()
Description copied from interface:Joint
Returns the number of bodies involved in this joint.- Specified by:
getBodyCount
in interfaceJoint<T extends PhysicsBody>
- Overrides:
getBodyCount
in classAbstractJoint<T extends PhysicsBody>
- Returns:
- int
-
getBody
public final T getBody(int i)
Description copied from interface:Joint
Returns the body at the given index.- Specified by:
getBody
in interfaceJoint<T extends PhysicsBody>
- Overrides:
getBody
in classAbstractJoint<T extends PhysicsBody>
- Parameters:
i
- the index- Returns:
- T
-
isMember
public final boolean isMember(CollisionBody<?> body)
Description copied from interface:Joint
Returns true if the given body is a member of this joint.- Specified by:
isMember
in interfaceJoint<T extends PhysicsBody>
- Overrides:
isMember
in classAbstractJoint<T extends PhysicsBody>
- Parameters:
body
- the body- Returns:
- boolean
-
isEnabled
public final boolean isEnabled()
Description copied from interface:Joint
Returns true if thisJoint
is enabled.A joint is only enabled if all joined
PhysicsBody
s are enabled.- Specified by:
isEnabled
in interfaceJoint<T extends PhysicsBody>
- Overrides:
isEnabled
in classAbstractJoint<T extends PhysicsBody>
- Returns:
- boolean
-
-