updated Jamfile, character demo, concave demo
reset for character demo (on space), and local refit of tree
This commit is contained in:
@@ -406,6 +406,15 @@ void CharacterDemo::displayCallback(void)
|
||||
void CharacterDemo::clientResetScene()
|
||||
{
|
||||
m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(m_character->getRigidBody()->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
|
||||
|
||||
btTransform startTransform;
|
||||
startTransform.setIdentity ();
|
||||
startTransform.setOrigin (btVector3(0.0, 2.0, 0.0));
|
||||
|
||||
m_character->getRigidBody()->getMotionState()->setWorldTransform(startTransform);
|
||||
m_character->getRigidBody()->setLinearVelocity(btVector3(0,0,0));
|
||||
m_character->getRigidBody()->setAngularVelocity(btVector3(0,0,0));
|
||||
|
||||
}
|
||||
|
||||
void CharacterDemo::specialKeyboardUp(int key, int x, int y)
|
||||
@@ -466,7 +475,7 @@ void CharacterDemo::specialKeyboard(int key, int x, int y)
|
||||
gRight = 1;
|
||||
}
|
||||
break;
|
||||
case GLUT_KEY_END:
|
||||
case GLUT_KEY_F1:
|
||||
{
|
||||
if (m_character && m_character->canJump())
|
||||
gJump = 1;
|
||||
|
||||
@@ -49,7 +49,7 @@ class ConcaveDemo : public DemoApplication
|
||||
|
||||
public:
|
||||
|
||||
ConcaveDemo() : m_animatedMesh(false)
|
||||
ConcaveDemo() : m_animatedMesh(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -315,12 +315,33 @@ void ConcaveDemo::clientMoveAndDisplay()
|
||||
static float offset=0.f;
|
||||
offset+=0.01f;
|
||||
|
||||
setVertexPositions(waveheight,offset);
|
||||
// setVertexPositions(waveheight,offset);
|
||||
|
||||
btVector3 worldMin(-1000,-1000,-1000);
|
||||
btVector3 worldMax(1000,1000,1000);
|
||||
int i;
|
||||
int j;
|
||||
btVector3 aabbMin(1e30,1e30,1e30);
|
||||
btVector3 aabbMax(-1e30,-1e30,-1e30);
|
||||
|
||||
trimeshShape->refitTree(worldMin,worldMax);
|
||||
for ( i=NUM_VERTS_X/2-3;i<NUM_VERTS_X/2+2;i++)
|
||||
{
|
||||
for (j=NUM_VERTS_X/2-3;j<NUM_VERTS_Y/2+2;j++)
|
||||
{
|
||||
|
||||
aabbMax.setMax(gVertices[i+j*NUM_VERTS_X]);
|
||||
aabbMin.setMin(gVertices[i+j*NUM_VERTS_X]);
|
||||
|
||||
gVertices[i+j*NUM_VERTS_X].setValue((i-NUM_VERTS_X*0.5f)*TRIANGLE_SIZE,
|
||||
//0.f,
|
||||
waveheight*sinf((float)i+offset)*cosf((float)j+offset),
|
||||
(j-NUM_VERTS_Y*0.5f)*TRIANGLE_SIZE);
|
||||
|
||||
aabbMin.setMin(gVertices[i+j*NUM_VERTS_X]);
|
||||
aabbMax.setMax(gVertices[i+j*NUM_VERTS_X]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
trimeshShape->partialRefitTree(aabbMin,aabbMax);
|
||||
|
||||
//clear all contact points involving mesh proxy. Note: this is a slow/unoptimized operation.
|
||||
m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(staticBody->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
|
||||
|
||||
@@ -71,6 +71,7 @@ SubInclude TOP Demos BspDemo ;
|
||||
SubInclude TOP Demos BasicDemo ;
|
||||
SubInclude TOP Demos ConvexDecompositionDemo ;
|
||||
SubInclude TOP Demos ColladaDemo ;
|
||||
SubInclude TOP Demos CharacterDemo ;
|
||||
SubInclude TOP Demos VehicleDemo ;
|
||||
SubInclude TOP Demos CollisionDemo ;
|
||||
SubInclude TOP Demos CollisionInterfaceDemo ;
|
||||
|
||||
@@ -12,7 +12,7 @@ if $(GLUT.AVAILABLE) = "yes"
|
||||
CFlags bulletopenglsupport : [ FIncludes $(TOP)/Extras/ConvexHull ]
|
||||
;
|
||||
|
||||
MsvcIncDirs $(<) :
|
||||
MsvcIncDirs bulletopenglsupport :
|
||||
"../../Extras/ConvexHull" ;
|
||||
|
||||
bulletopenglsupport.CFLAGS = [ FIncludes $(TOP)/Extras/ConvexHull ] ;
|
||||
|
||||
Reference in New Issue
Block a user