public class CollisionBehavior extends CollisionComponent implements Renderable
Modifier and Type | Class and Description |
---|---|
static class |
CollisionBehavior.Method
Specifies how the constraints are generated for handling collisions.
|
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
CollisionBehavior()
Creates a new CollisionBehavior with default values.
|
CollisionBehavior(boolean enabled,
double mu)
Creates a new CollisionBehavior with a specified enabling
and friction.
|
CollisionBehavior(CollisionBehavior behav) |
Modifier and Type | Method and Description |
---|---|
RenderProps |
createRenderProps()
Factory method to create render properties appropriate to this object.
|
double |
getAcceleration()
Returns the desired collision acceleration.
|
PropertyMode |
getAccelerationMode() |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
boolean |
getBodyFaceContact()
Queries whether body face contact is enabled.
|
PropertyMode |
getBodyFaceContactMode() |
CollisionManager.ColliderType |
getColliderType()
Returns the collider type to be used for determining collisions.
|
PropertyMode |
getColliderTypeMode() |
double |
getCompliance()
Gets the contact compliance associated with this behavior.
|
PropertyMode |
getComplianceMode() |
double |
getDamping()
Gets the contact damping associated with this behavior.
|
PropertyMode |
getDampingMode() |
boolean |
getDrawConstraints() |
PropertyMode |
getDrawConstraintsMode() |
boolean |
getDrawContactNormals() |
PropertyMode |
getDrawContactNormalsMode() |
boolean |
getDrawIntersectionContours() |
PropertyMode |
getDrawIntersectionContoursMode() |
boolean |
getDrawIntersectionFaces() |
PropertyMode |
getDrawIntersectionFacesMode() |
boolean |
getDrawIntersectionPoints() |
PropertyMode |
getDrawIntersectionPointsMode() |
int |
getDrawPenetrationDepth() |
PropertyMode |
getDrawPenetrationDepthMode() |
ContactForceBehavior |
getForceBehavior() |
double |
getFriction()
Gets the Coulomb friction coefficent associated with this behavior.
|
PropertyMode |
getFrictionMode() |
CollisionBehavior.Method |
getMethod()
Returns the collision method to be used by this behavior.
|
PropertyMode |
getMethodMode() |
ScalarRange |
getPenetrationDepthRange() |
double |
getPenetrationTol()
Gets the penetration tolerance associated with this behavior.
|
PropertyMode |
getPenetrationTolMode() |
boolean |
getReduceConstraints()
Queries whether constraint reduction is enabled for this behavior.
|
PropertyMode |
getReduceConstraintsMode() |
int |
getRenderHints()
Returns a bit code giving rendering hints about this renderable.
|
RenderProps |
getRenderProps()
Returns the render properities for this object.
|
double |
getRigidPointTol()
Gets the rigid point tolerance associated with this behavior.
|
PropertyMode |
getRigidPointTolMode() |
double |
getRigidRegionTol()
Gets the rigid region tolerance associated with this behavior.
|
PropertyMode |
getRigidRegionTolMode() |
void |
getSelection(java.util.LinkedList<java.lang.Object> list,
int qid)
Append to
list the component (or components) associated with
the qid -th selection query issued by this component's render
method. |
boolean |
isCompliant() |
boolean |
isEnabled()
Returns true if collisions are enabled in this behavior.
|
boolean |
isSelectable()
Returns true if this object is in fact selectable.
|
int |
numSelectionQueriesNeeded()
If this selectable manages its own selection (by issuing selection
queries within its
render method), then this method should
return the maximum number of selection queries that will be
required. |
void |
prerender(RenderList list)
Called prior to rendering to allow this object to update the internal
state required for rendering (such as by caching rendering coordinates).
|
void |
render(Renderer renderer,
int flags)
Render method for this component is just a stub - it is needed because
this class extends RenderableComponentBase, which is done to export the
fact that the class has render properties, and also exports them as a
property.
|
void |
scaleDistance(double s) |
void |
scaleMass(double s) |
void |
set(CollisionBehavior behav) |
void |
setAcceleration(double acc)
Sets a desired acceleration for collision response which will be used to
automatically compute collision compliance if the specified compliance
(as returned by
getCompliance() ) is zero. |
void |
setAccelerationMode(PropertyMode mode) |
void |
setBodyFaceContact(boolean enable)
Enables or disables body face contact.
|
void |
setBodyFaceContactMode(PropertyMode mode) |
void |
setColliderType(CollisionManager.ColliderType ctype)
Set the collider type to be used for determining collisions.
|
void |
setColliderTypeMode(PropertyMode mode) |
void |
setCompliance(double c)
Sets the contact compliance associated with this behavior.
|
void |
setComplianceMode(PropertyMode mode) |
void |
setDamping(double d)
Sets the contact damping associated with this behavior.
|
void |
setDampingMode(PropertyMode mode) |
void |
setDrawConstraints(boolean enable) |
void |
setDrawConstraintsMode(PropertyMode mode) |
void |
setDrawContactNormals(boolean enable) |
void |
setDrawContactNormalsMode(PropertyMode mode) |
void |
setDrawIntersectionContours(boolean enable) |
void |
setDrawIntersectionContoursMode(PropertyMode mode) |
void |
setDrawIntersectionFaces(boolean enable) |
void |
setDrawIntersectionFacesMode(PropertyMode mode) |
void |
setDrawIntersectionPoints(boolean enable) |
void |
setDrawIntersectionPointsMode(PropertyMode mode) |
void |
setDrawPenetrationDepth(int meshNum) |
void |
setDrawPenetrationDepthMode(PropertyMode mode) |
void |
setEnabled(boolean enabled)
Enables or disabled collisions for this behavior.
|
void |
setForceBehavior(ContactForceBehavior behavior) |
void |
setFriction(double mu)
Sets the Coulomb friction coefficent associated with this behavior.
|
void |
setFrictionMode(PropertyMode mode) |
void |
setMethod(CollisionBehavior.Method method)
Set the collision method to be used by this behavior.
|
void |
setMethodMode(PropertyMode mode) |
void |
setPenetrationDepthRange(ScalarRange range) |
void |
setPenetrationTol(double tol)
Sets the penetration tolerance associated with this behavior.
|
void |
setPenetrationTolMode(PropertyMode mode) |
void |
setReduceConstraints(boolean enable)
Sets whether or not constraint reduction is enabled for this behavior.
|
void |
setReduceConstraintsMode(PropertyMode mode) |
void |
setRenderProps(RenderProps props)
Assigns a new set of render properties to this object.
|
void |
setRigidPointTol(double tol)
Sets the rigid point tolerance associated with this behavior.
|
void |
setRigidPointTolMode(PropertyMode mode) |
void |
setRigidRegionTol(double tol)
Sets the rigid region tolerance associated with this behavior.
|
void |
setRigidRegionTolMode(PropertyMode mode) |
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
getCollidable, getCollidablePair, getHardReferences, setCollidablePair, setCollidablePair
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, copy, createTempFlag, disconnectFromHierarchy, getChildren, getGrandParent, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
public static PropertyList myProps
public CollisionBehavior()
public CollisionBehavior(boolean enabled, double mu)
enabled
- true if collisions are enabledmu
- friction coefficientpublic CollisionBehavior(CollisionBehavior behav)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- if true, enables collisionspublic double getFriction()
public void setFriction(double mu)
mu
- friction coefficentpublic void setFrictionMode(PropertyMode mode)
public PropertyMode getFrictionMode()
public CollisionBehavior.Method getMethod()
public void setMethod(CollisionBehavior.Method method)
method
- collision method to be usedpublic void setMethodMode(PropertyMode mode)
public PropertyMode getMethodMode()
public CollisionManager.ColliderType getColliderType()
public void setColliderType(CollisionManager.ColliderType ctype)
ctype
- new collider type for this behaviorpublic void setColliderTypeMode(PropertyMode mode)
public PropertyMode getColliderTypeMode()
public double getPenetrationTol()
public void setPenetrationTol(double tol)
tol
- new penetration tolerancepublic void setPenetrationTolMode(PropertyMode mode)
public PropertyMode getPenetrationTolMode()
public double getCompliance()
public void setCompliance(double c)
c
- new contact compliancepublic void setComplianceMode(PropertyMode mode)
public PropertyMode getComplianceMode()
public double getDamping()
public void setDamping(double d)
d
- new contact dampingpublic void setDampingMode(PropertyMode mode)
public PropertyMode getDampingMode()
public double getAcceleration()
setAcceleration(double)
.public void setAcceleration(double acc)
getCompliance()
) is zero.
This property is currently experimental and not guaranteed to produce reliable results.
acc
- desired collision accelerationpublic void setAccelerationMode(PropertyMode mode)
public PropertyMode getAccelerationMode()
public double getRigidRegionTol()
public void setRigidRegionTol(double tol)
tol
- new rigid region tolerancepublic void setRigidRegionTolMode(PropertyMode mode)
public PropertyMode getRigidRegionTolMode()
public double getRigidPointTol()
public void setRigidPointTol(double tol)
tol
- new rigid point tolerancepublic void setRigidPointTolMode(PropertyMode mode)
public PropertyMode getRigidPointTolMode()
public void setForceBehavior(ContactForceBehavior behavior)
public ContactForceBehavior getForceBehavior()
public boolean getReduceConstraints()
public void setReduceConstraints(boolean enable)
enable
- true if constraint reduction should be enabledpublic void setReduceConstraintsMode(PropertyMode mode)
public PropertyMode getReduceConstraintsMode()
public boolean getBodyFaceContact()
setBodyFaceContact(boolean)
for details.public void setBodyFaceContact(boolean enable)
false
, since such contacts can result
in an overconstrained system.enable
- true if body face contact should be enabledpublic void setBodyFaceContactMode(PropertyMode mode)
public PropertyMode getBodyFaceContactMode()
public boolean getDrawIntersectionContours()
public void setDrawIntersectionContours(boolean enable)
public void setDrawIntersectionContoursMode(PropertyMode mode)
public PropertyMode getDrawIntersectionContoursMode()
public boolean getDrawIntersectionFaces()
public void setDrawIntersectionFaces(boolean enable)
public void setDrawIntersectionFacesMode(PropertyMode mode)
public PropertyMode getDrawIntersectionFacesMode()
public boolean getDrawIntersectionPoints()
public void setDrawIntersectionPoints(boolean enable)
public void setDrawIntersectionPointsMode(PropertyMode mode)
public PropertyMode getDrawIntersectionPointsMode()
public boolean getDrawContactNormals()
public void setDrawContactNormals(boolean enable)
public void setDrawContactNormalsMode(PropertyMode mode)
public PropertyMode getDrawContactNormalsMode()
public boolean getDrawConstraints()
public void setDrawConstraints(boolean enable)
public void setDrawConstraintsMode(PropertyMode mode)
public PropertyMode getDrawConstraintsMode()
public int getDrawPenetrationDepth()
public void setDrawPenetrationDepth(int meshNum)
public void setDrawPenetrationDepthMode(PropertyMode mode)
public PropertyMode getDrawPenetrationDepthMode()
public void setPenetrationDepthRange(ScalarRange range)
public ScalarRange getPenetrationDepthRange()
public boolean isCompliant()
public void set(CollisionBehavior behav)
public RenderProps getRenderProps()
HasRenderProps
getRenderProps
in interface HasRenderProps
public void setRenderProps(RenderProps props)
HasRenderProps
null
will remove render properties from this object.setRenderProps
in interface HasRenderProps
props
- new render properties for this objectpublic void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
list
- list of objects to be renderedpublic void render(Renderer renderer, int flags)
render
in interface IsRenderable
renderer
- provides the functionality used to perform the rendering.flags
- flags that may be used to control different
aspects of the rendering. Flags are defined in Renderer
and currently include
Renderer.HIGHLIGHT
and
Renderer.SORT_FACES
.public void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
pmin
- minimum pointpmax
- maximum pointpublic void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
IsSelectable
list
the component (or components) associated with
the qid
-th selection query issued by this component's render
method. This will only be called if this component manages its own
selection (i.e., the number nums
returned by IsSelectable.numSelectionQueriesNeeded()
is positive), and qid
will in
turn be a number between 0 and nums
-1.getSelection
in interface IsSelectable
list
- selected objects are appended to the end of this listqid
- index of the selection querypublic RenderProps createRenderProps()
HasRenderProps
createRenderProps
in interface HasRenderProps
public int getRenderHints()
IsRenderable
TRANSPARENT
and
TWO_DIMENSIONAL
.getRenderHints
in interface IsRenderable
public boolean isSelectable()
isSelectable
in interface IsSelectable
public int numSelectionQueriesNeeded()
IsSelectable
render
method), then this method should
return the maximum number of selection queries that will be
required. Otherwise, this method should return -1.numSelectionQueriesNeeded
in interface IsSelectable
public void scaleDistance(double s)
public void scaleMass(double s)