|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbox2d.collision.Shape
public abstract class Shape
A shape is used for collision detection. Shapes are created in World.
You can use shape for collision detection before they are attached to the world.
Warning: you cannot reuse shapes on different bodies, they must
be re-created or copied.
Field Summary | |
---|---|
Body |
m_body
|
float |
m_density
|
FilterData |
m_filter
|
float |
m_friction
|
boolean |
m_isSensor
|
Shape |
m_next
|
int |
m_proxyId
|
float |
m_restitution
|
float |
m_sweepRadius
Sweep radius relative to the parent body's center of mass. |
ShapeType |
m_type
|
java.lang.Object |
m_userData
|
int |
uid
Unique id for shape for sorting (C++ version uses memory address) |
Constructor Summary | |
---|---|
Shape(ShapeDef def)
|
Method Summary | |
---|---|
abstract void |
computeAABB(AABB aabb,
XForm xf)
Given a transform, compute the associated axis aligned bounding box for this shape. |
abstract void |
computeMass(MassData massData)
Compute the mass properties of this shape using its dimensions and density. |
abstract void |
computeSweptAABB(AABB aabb,
XForm xf1,
XForm xf2)
Given two transforms, compute the associated swept axis aligned bounding box for this shape. |
static Shape |
create(ShapeDef def)
Internal |
void |
createProxy(BroadPhase broadPhase,
XForm transform)
Internal |
static void |
destroy(Shape s)
Internal |
void |
destroyProxy(BroadPhase broadPhase)
Internal |
void |
destructor()
Internal |
Body |
getBody()
Get the parent body of this shape. |
FilterData |
getFilterData()
Get the collision filtering data. |
float |
getFriction()
Get the coefficient of friction. |
Shape |
getNext()
Get the next shape in the parent body's shape list. |
float |
getRestitution()
Get the coefficient of restitution. |
float |
getSweepRadius()
Get the sweep radius of the shape. |
ShapeType |
getType()
Get the type of this shape. |
java.lang.Object |
getUserData()
Get the user data that was assigned in the shape definition. |
boolean |
isSensor()
Is this shape a sensor (non-solid)? |
void |
refilterProxy(BroadPhase broadPhase,
XForm transform)
Internal |
void |
setFilterData(FilterData filter)
Set the collision filtering data. |
void |
setFriction(float friction)
Set the coefficient of friction. |
void |
setRestitution(float restitution)
Set the coefficient of restitution. |
void |
setUserData(java.lang.Object o)
Set the user data associated with the object. |
boolean |
synchronize(BroadPhase broadPhase,
XForm transform1,
XForm transform2)
Internal |
abstract boolean |
testPoint(XForm xf,
Vec2 p)
Test a point for containment in this shape. |
abstract void |
updateSweepRadius(Vec2 center)
Internal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int uid
public ShapeType m_type
public Shape m_next
public Body m_body
public float m_sweepRadius
public float m_density
public float m_friction
public float m_restitution
public int m_proxyId
public FilterData m_filter
public boolean m_isSensor
public java.lang.Object m_userData
Constructor Detail |
---|
public Shape(ShapeDef def)
Method Detail |
---|
public float getFriction()
public void setFriction(float friction)
public float getRestitution()
public void setRestitution(float restitution)
public void setFilterData(FilterData filter)
public FilterData getFilterData()
public ShapeType getType()
public boolean isSensor()
public java.lang.Object getUserData()
public void setUserData(java.lang.Object o)
o
- User data to setpublic Body getBody()
public Shape getNext()
public float getSweepRadius()
public abstract boolean testPoint(XForm xf, Vec2 p)
xf
- the shape world transform.p
- a point in world coordinates.
public abstract void computeAABB(AABB aabb, XForm xf)
aabb
- returns the axis aligned box.xf
- the world transform of the shape.public abstract void computeSweptAABB(AABB aabb, XForm xf1, XForm xf2)
aabb
- returns the axis aligned box. (return parameter)xf1
- the starting shape world transform.xf2
- the ending shape world transform.public abstract void computeMass(MassData massData)
massData
- returns the mass data for this shape. (return parameter)public abstract void updateSweepRadius(Vec2 center)
public boolean synchronize(BroadPhase broadPhase, XForm transform1, XForm transform2)
public void refilterProxy(BroadPhase broadPhase, XForm transform)
public static Shape create(ShapeDef def)
public static void destroy(Shape s)
public void destructor()
public void createProxy(BroadPhase broadPhase, XForm transform)
public void destroyProxy(BroadPhase broadPhase)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |