|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.odejava.Space
public abstract class Space
A space is a non-placeable geom that can contain other geoms. It is similar to the rigid body concept of the world, except that it applies to collision instead of dynamics.
Space objects exist to make collision detection go faster. Without spaces, you might generate contacts in your simulation by calling dCollide() to get contact points for every single pair of geoms. For N geoms this is O(N2) tests, which is too computationally expensive if your environment has many objects.
Developer note: currently all Geoms and even Body objects are stored also to Space object's as LinkedLists. This is for convenience. Spaces however have to do with collision only.
Created 16.12.2003 (dd.mm.yyyy)
| Field Summary | |
|---|---|
protected boolean |
deleted
Flag indicating that this world has been requested to be deleted. |
protected LinkedList<Geom> |
geomList
|
protected HashMap<String,Geom> |
geomMap
|
protected org.odejava.ode.SWIGTYPE_p_dSpaceID |
parentId
The identifier or the parent ODE space object to us |
protected org.odejava.ode.SWIGTYPE_p_dSpaceID |
spaceId
Our ODE space identifier |
static org.odejava.ode.SWIGTYPE_p_dSpaceID |
SPACEID_ZERO
Deprecated. This is no longer needed and will be deleted shortly. Zero IDs are automatically derived from null references to objects |
| Constructor Summary | |
|---|---|
Space()
Create a generic space object that does not have a parent space. |
|
Space(Space parent)
Create a generic space object that belongs to the given parent space. |
|
| Method Summary | |
|---|---|
void |
add(Geom geom)
Add a single item of geometry to this space. |
void |
addBodyGeoms(Body body)
Adds all of the geoms that belong to the passed Body. |
void |
addGeom(Geom geom)
Add a single item of geometry to this space. |
boolean |
containsGeom(String name)
Returns true if the space contains a Geom with the given name. |
void |
delete()
Request deletion of this space. |
boolean |
getChildCleanupMode()
Get the child cleanup mode to be used after the next delete. |
Geom |
getGeom(String name)
Get Geom by name. |
HashMap<String,Geom> |
getGeomMap()
Get the internal mapping of names to geometry objects. |
List<Geom> |
getGeoms()
Gets a list of the Geoms in the scene. |
org.odejava.ode.SWIGTYPE_p_dSpaceID |
getId()
|
long |
getID()
|
long |
getNativeAddr()
Native address can be used to compare against contact information values which are also native addresses. |
static Space |
getSpaceFromNativeAddr(long nativeAddress)
Performs lookup of a WeakHashMap and returns the Geom with the native address equal to the one passed or null if none exist. |
Object |
getUserData()
|
boolean |
isEnabled()
|
void |
remove(Geom geom)
Removes a Geom from this Space. |
void |
renameGeom(String oldName,
String newName)
|
void |
setChildCleanupMode(boolean killKids)
Set the cleanup mode to be used by this space when it is deleted. |
void |
setEnabled(boolean enabled)
Diables or Enables this geom. |
void |
setUserData(Object userData)
|
protected void |
updateNativeAddr()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.odejava.ode.SWIGTYPE_p_dSpaceID spaceId
protected org.odejava.ode.SWIGTYPE_p_dSpaceID parentId
protected LinkedList<Geom> geomList
protected HashMap<String,Geom> geomMap
@Deprecated public static final org.odejava.ode.SWIGTYPE_p_dSpaceID SPACEID_ZERO
protected boolean deleted
| Constructor Detail |
|---|
public Space()
public Space(Space parent)
parent - A reference to the parent space, or null| Method Detail |
|---|
public final Object getUserData()
public final void setUserData(Object userData)
userData - The userData to set.public void addGeom(Geom geom)
geom - The geometry instance to add
IllegalOdejavaOperation - The geom is already part of this spacepublic void add(Geom geom)
geom - The geometry instance to add
IllegalOdejavaOperation - The geom is already part of this spacepublic void addBodyGeoms(Body body)
body - A body to get the geometry(s) from
IllegalOdejavaOperation - The geom is already part of this spacepublic void remove(Geom geom)
IllegalArgumentException - if the Geom is not currently in this space.public List<Geom> getGeoms()
public Geom getGeom(String name)
name - The name of the geometry to fetch
public void renameGeom(String oldName,
String newName)
public boolean containsGeom(String name)
name - the name of the Geom
public HashMap<String,Geom> getGeomMap()
public void setChildCleanupMode(boolean killKids)
killKids - true to delete the child geometry toopublic boolean getChildCleanupMode()
public void delete()
public org.odejava.ode.SWIGTYPE_p_dSpaceID getId()
public final long getID()
public static Space getSpaceFromNativeAddr(long nativeAddress)
nativeAddress - the native address to lookup
protected void updateNativeAddr()
public long getNativeAddr()
Native address can be used to compare against contact information values which are also native addresses.
UNSUPPORTED - use of this method is better avoided. No guarantees are made that this method won't change or even exist in future versions.
public void setEnabled(boolean enabled)
enabled -
dGeomEnable - (if true is passed) |
dGeomDiable - (if false is passed) |
public boolean isEnabled()
dGeomEnable - (if true is passed) |
dGeomDiable - (if false is passed) |
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||