com.jmex.effects.cloth
Class CollidingClothPatch
java.lang.Object
com.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.scene.TriMesh
com.jmex.effects.cloth.ClothPatch
com.jmex.effects.cloth.CollidingClothPatch
- All Implemented Interfaces:
- Savable, java.io.Serializable
public class CollidingClothPatch
- extends ClothPatch
CollidingClothPatch
is a ClothPatch with the ability to
interact with other objects. Override handleCollision to change collision
behavior.
- Version:
- $Id: CollidingClothPatch.java 4133 2009-03-19 20:40:11Z blaine.dev $
- Author:
- Joshua Slack
- See Also:
- Serialized Form
Fields inherited from class com.jme.scene.Geometry |
binormalBuf, bound, castsShadows, colorBuf, compVect, defaultColor, displayListID, enabled, fogBuf, hasDirtyVertices, normBuf, states, tangentBuf, texBuf, vboInfo, vertBuf, vertQuantity |
Fields inherited from class com.jme.scene.Spatial |
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
Constructor Summary |
CollidingClothPatch(java.lang.String name,
int nodesX,
int nodesY,
float springLength,
float nodeMass)
Public constructor. |
Method Summary |
void |
addCollider(TriMesh item)
Adds a TriMesh to check for collision with. |
protected void |
calcForces(float sinceLast)
Calls super and then updates model bound and collision info. |
protected void |
checkForCollisions()
Check each collider for collision with this Cloth. |
protected void |
handleCollision(TriMesh target,
int srcTriIndex,
int tgtTriIndex)
Given the starting triangle index of the two triangles intersecting,
decide what to do with those triangles. |
void |
read(JMEImporter e)
|
boolean |
removeCollider(TriMesh item)
Remove a given TriMesh from collision consideration. |
void |
write(JMEExporter e)
|
Methods inherited from class com.jmex.effects.cloth.ClothPatch |
addForce, doUpdate, getClothNodesX, getClothNodesY, getIndex, getSpringLength, getSystem, getTimeDilation, getTriangleNormal, initCloth, initCloth, removeForce, setActive, setTimeDilation, setUpdateFrequency, setupIndices, updateNormals, updateVertexBufferfer, updateWorldData |
Methods inherited from class com.jme.scene.TriMesh |
clearBuffers, draw, findCollisions, findTriangleCollision, findTrianglePick, getIndexBuffer, getMaxIndex, getMeshAsTriangles, getMeshAsTrianglesVertices, getMode, getTriangle, getTriangle, getTriangleCount, getTriangleIndices, getVertIndex, hasCollision, hasTriangleCollision, randomPointOnTriangles, recalcTriangleQuantity, reconstruct, setIndexBuffer, setMode, setTriangleQuantity |
Methods inherited from class com.jme.scene.Geometry |
addTextureCoordinates, addTextureCoordinates, applyRenderState, checkTextureCoordinates, clearTextureBuffers, copyTextureCoordinates, copyTextureCoordinates, findPick, getBinormalBuffer, getColorBuffer, getDefaultColor, getDisplayListID, getFogBuffer, getLightState, getModelBound, getNormalBuffer, getNumberOfUnits, getTangentBuffer, getTextureCoords, getTextureCoords, getVBOInfo, getVertexBuffer, getVertexCount, getWorldCoords, getWorldNormals, hasDirtyVertices, isCastsShadows, lockMeshes, postdraw, predraw, randomVertex, reconstruct, resizeTextureIds, rotateNormals, rotatePoints, scaleTextureCoordinates, scaleTextureCoordinates, setBinormalBuffer, setCastsShadows, setColorBuffer, setDefaultColor, setDisplayListID, setFogCoordBuffer, setHasDirtyVertices, setLightState, setModelBound, setNormalBuffer, setRandomColors, setSolidColor, setTangentBuffer, setTextureCoords, setTextureCoords, setTextureCoords, setVBOInfo, setVertexBuffer, setVertexCount, sortLights, translatePoints, translatePoints, unlockMeshes, updateModelBound, updateWorldBound |
Methods inherited from class com.jme.scene.Spatial |
addController, calculateCollisions, calculatePick, clearControllers, clearRenderState, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, isCollidable, localToWorld, lock, lock, lockBounds, lockBranch, lockMeshes, lockShadows, lockTransforms, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBounds, unlockBranch, unlockMeshes, unlockShadows, unlockTransforms, updateGeometricState, updateRenderState, updateRenderState, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, updateWorldVectors, worldToLocal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
results
protected TriangleCollisionResults results
- Used for storing the results of collisions.
colliders
protected java.util.ArrayList<TriMesh> colliders
- Array of TriMesh objects to check against for collision.
srcTemps
protected SpringPoint[] srcTemps
calcTemp
protected Vector3f calcTemp
CollidingClothPatch
public CollidingClothPatch(java.lang.String name,
int nodesX,
int nodesY,
float springLength,
float nodeMass)
- Public constructor.
- Parameters:
name
- StringnodesX
- number of nodes wide this cloth will be.nodesY
- number of nodes high this cloth will be.springLength
- distance between each nodenodeMass
- mass of an individual node in this Cloth.
calcForces
protected void calcForces(float sinceLast)
- Calls super and then updates model bound and collision info.
- Overrides:
calcForces
in class ClothPatch
- Parameters:
sinceLast
- float
checkForCollisions
protected void checkForCollisions()
- Check each collider for collision with this Cloth.
handleCollision
protected void handleCollision(TriMesh target,
int srcTriIndex,
int tgtTriIndex)
- Given the starting triangle index of the two triangles intersecting,
decide what to do with those triangles.
- Parameters:
target
- TriMeshsrcTriIndex
- inttgtTriIndex
- int
addCollider
public void addCollider(TriMesh item)
- Adds a TriMesh to check for collision with.
- Parameters:
item
- TriMesh
removeCollider
public boolean removeCollider(TriMesh item)
- Remove a given TriMesh from collision consideration.
- Parameters:
item
- TriMesh
- Returns:
- true if found and removed
write
public void write(JMEExporter e)
throws java.io.IOException
- Specified by:
write
in interface Savable
- Overrides:
write
in class ClothPatch
- Throws:
java.io.IOException
read
public void read(JMEImporter e)
throws java.io.IOException
- Specified by:
read
in interface Savable
- Overrides:
read
in class ClothPatch
- Throws:
java.io.IOException