public abstract class

AbstractJoint

extends Object
implements Joint
java.lang.Object
   ↳ sofia.graphics.AbstractJoint<JointType extends org.jbox2d.dynamics.joints.Joint, JointDefType extends org.jbox2d.dynamics.joints.JointDef>
Known Direct Subclasses

Class Overview

TODO document

Summary

Public Constructors
AbstractJoint(Shape firstShape, Shape secondShape)
Initializes a new joint with the specified shapes.
Public Methods
void connect()
Activates the joint.
void disconnect()
Deactivates the joint, releasing the connection between the two shapes.
JointType getB2Joint()
JointDefType getB2JointDef()
boolean getCollideConnected()
Shape getFirstShape()
Gets the first shape connected by this joint.
Shape getSecondShape()
Gets the second shape connected by this joint.
void setCollideConnected(boolean collide)
Protected Methods
abstract JointDefType createB2JointDef()
Subclasses must override this method to create the appropriate Box2D JointDef instance that represents the specific type of joint.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sofia.graphics.Joint

Public Constructors

public AbstractJoint (Shape firstShape, Shape secondShape)

Initializes a new joint with the specified shapes.

Parameters
firstShape the first shape connected by this joint
secondShape the second shape connected by this joint

Public Methods

public void connect ()

Activates the joint. You must call this method after creating the joint object if you want it to have any effect.

public void disconnect ()

Deactivates the joint, releasing the connection between the two shapes.

public JointType getB2Joint ()

public JointDefType getB2JointDef ()

public boolean getCollideConnected ()

public Shape getFirstShape ()

Gets the first shape connected by this joint.

Returns
  • the first shape connected by this joint

public Shape getSecondShape ()

Gets the second shape connected by this joint.

Returns
  • the second shape connected by this joint

public void setCollideConnected (boolean collide)

Protected Methods

protected abstract JointDefType createB2JointDef ()

Subclasses must override this method to create the appropriate Box2D JointDef instance that represents the specific type of joint. This method should fill in all required properties of the joint, including the bodyA and bodyB references.

Returns
  • the subclass of JointDef that represents this specific type of joint