public abstract class CollisionShape extends java.lang.Object implements Savable
Collision shapes include BoxCollisionShape and CapsuleCollisionShape. As suggested in the Bullet manual, a single collision shape can be shared among multiple collision objects.
Modifier and Type | Field and Description |
---|---|
protected float |
margin
copy of collision margin (in physics-space units, >0, default=0)
|
protected long |
objectId
unique identifier of the btCollisionShape
|
protected Vector3f |
scale
copy of scaling factors: one for each local axis (default=1,1,1)
|
Constructor and Description |
---|
CollisionShape() |
Modifier and Type | Method and Description |
---|---|
protected void |
finalize()
Finalize this shape just before it is destroyed.
|
static float |
getDefaultMargin()
Read the default margin for new shapes.
|
float |
getMargin()
Read the collision margin for this shape.
|
long |
getObjectId()
Read the id of the btCollisionShape.
|
Vector3f |
getScale()
Access the scaling factors.
|
boolean |
isNonMoving()
Test whether this shape can be applied to a dynamic rigid body.
|
void |
read(JmeImporter im)
De-serialize this shape, for example when loading from a J3O file.
|
static void |
setDefaultMargin(float margin)
Alter the default margin for new shapes that are neither capsules nor
spheres.
|
void |
setMargin(float margin)
Alter the collision margin of this shape.
|
void |
setObjectId(long id)
used internally
|
void |
setScale(Vector3f scale)
Alter the scaling factors of this shape.
|
void |
write(JmeExporter ex)
Serialize this shape, for example when saving to a J3O file.
|
protected long objectId
Constructors are responsible for setting this to a non-zero value. After that, the id never changes.
protected Vector3f scale
protected float margin
public long getObjectId()
public void setObjectId(long id)
public void setScale(Vector3f scale)
Note that if the shape is shared (between collision objects and/or compound shapes) changes can have unintended consequences.
scale
- the desired scaling factor for each local axis (not null, no
negative component, unaffected, default=1,1,1)public Vector3f getScale()
public boolean isNonMoving()
public float getMargin()
public static void setDefaultMargin(float margin)
margin
- the desired margin distance (in physics-space units, >0,
default=0.04)public static float getDefaultMargin()
public void setMargin(float margin)
Note that if the shape is shared (between collision objects and/or compound shapes) changes can have unintended consequences.
margin
- the desired margin distance (in physics-space units, >0,
default=0.04)public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- ignored by the garbage collector