com.jme.effects.cloth
Class CollidingClothPatch

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Geometry
          extended bycom.jme.scene.TriMesh
              extended bycom.jme.effects.cloth.ClothPatch
                  extended bycom.jme.effects.cloth.CollidingClothPatch
All Implemented Interfaces:
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,v 1.2 2005/03/08 01:30:55 renanse Exp $
Author:
Joshua Slack
See Also:
Serialized Form

Field Summary
protected  Vector3f calcTemp
           
protected  java.util.ArrayList colliders
          Array of TriMesh objects to check against for collision.
protected  TriangleCollisionResults results
          Used for storing the results of collisions.
protected  SpringNode[] srcTemps
           
protected  Vector3f[] tgtTemps
           
 
Fields inherited from class com.jme.effects.cloth.ClothPatch
clothNodesX, clothNodesY, sinceLast, springLength, system, timeDilation
 
Fields inherited from class com.jme.scene.TriMesh
indices, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, 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.
 boolean removeCollider(TriMesh item)
          Remove a given TriMesh from collision consideration.
 
Methods inherited from class com.jme.effects.cloth.ClothPatch
addForce, doUpdate, getClothNodesX, getClothNodesY, getIndex, getSpringLength, getSystem, getTimeDilation, getTriangleNormal, initCloth, removeForce, setTimeDilation, setupIndices, updateNormals, updateWorldData
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, draw, drawBounds, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, getMeshAsTriangles, getTriangle, getTriangle, getTriangleQuantity, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree, updateIndexBuffer
 
Methods inherited from class com.jme.scene.Geometry
applyRenderState, applyStates, copyTextureCoords, findPick, getAllTextures, getCloneID, getColorAsFloatBuffer, getColors, getModelBound, getNormalAsFloatBuffer, getNormals, getNumberOfUnits, getTextureAsFloatBuffer, getTextureAsFloatBuffer, getTextures, getTextures, getVBOColorID, getVBONormalID, getVBOTextureID, getVBOVertexID, getVerticeAsFloatBuffer, getVertices, getVertQuantity, isVBOColorEnabled, isVBONormalEnabled, isVBOTextureEnabled, isVBOVertexEnabled, randomVertice, reconstruct, setAllTextures, setColor, setColors, setFloatBuffer, setForceView, setModelBound, setNormal, setNormalBuffer, setNormals, setRandomColors, setSolidColor, setTexture, setTexture, setTextureBuffer, setTextureCoord, setTextures, setTextures, setVBOColorEnabled, setVBOColorID, setVBONormalEnabled, setVBONormalID, setVBOTextureEnabled, setVBOTextureID, setVBOVertexEnabled, setVBOVertexID, setVertex, setVertexBuffer, setVertices, updateColorBuffer, updateColorBuffer, updateModelBound, updateNormalBuffer, updateNormalBuffer, updateTextureBuffer, updateTextureBuffer, updateTextureBuffer, updateVertexBuffer, updateVertexBuffer, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, setZOrder, toString, updateGeometricState, updateRenderState, updateRenderState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

results

protected TriangleCollisionResults results
Used for storing the results of collisions.


colliders

protected java.util.ArrayList colliders
Array of TriMesh objects to check against for collision.


srcTemps

protected SpringNode[] srcTemps

tgtTemps

protected Vector3f[] tgtTemps

calcTemp

protected Vector3f calcTemp
Constructor Detail

CollidingClothPatch

public CollidingClothPatch(java.lang.String name,
                           int nodesX,
                           int nodesY,
                           float springLength,
                           float nodeMass)
Public constructor.

Parameters:
name - String
nodesX - number of nodes wide this cloth will be.
nodesY - number of nodes high this cloth will be.
springLength - distance between each node
nodeMass - mass of an individual node in this Cloth.
Method Detail

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 - TriMesh
srcTriIndex - int
tgtTriIndex - 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