processed a lot of feedback: added 'realtime' simulation with fixed substeps (and clamping maximum number of substeps), this means that when stepSimulation is called with smaller timesteps then 'fixed substep' the motionstate is interpolated.
renamed m_ccdSweptSphereRadius, enabled wireframe debugDrawObject (using debugDrawer)
This commit is contained in:
@@ -21,8 +21,12 @@ subject to the following restrictions:
|
||||
#include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h"//picking
|
||||
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btBoxShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
|
||||
|
||||
#include "GL_ShapeDrawer.h"
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
#include "LinearMath/btDefaultMotionState.h"
|
||||
|
||||
#include "BMF_Api.h"
|
||||
|
||||
extern bool gDisableDeactivation;
|
||||
@@ -646,7 +650,9 @@ btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform
|
||||
if (isDynamic)
|
||||
shape->calculateLocalInertia(mass,localInertia);
|
||||
|
||||
btRigidBody* body = new btRigidBody(mass,startTransform,shape,localInertia);
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
|
||||
btRigidBody* body = new btRigidBody(mass,myMotionState,shape,localInertia);
|
||||
body->m_userObjectPointer = myMotionState;
|
||||
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
|
||||
@@ -656,7 +662,6 @@ btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform
|
||||
|
||||
|
||||
|
||||
|
||||
void DemoApplication::renderme()
|
||||
{
|
||||
updateCamera();
|
||||
@@ -670,7 +675,15 @@ void DemoApplication::renderme()
|
||||
for (int i=0;i<numObjects;i++)
|
||||
{
|
||||
btCollisionObject* colObj = m_dynamicsWorld->getCollisionObjectArray()[i];
|
||||
colObj->m_worldTransform.getOpenGLMatrix(m);
|
||||
|
||||
if (colObj->m_userObjectPointer)
|
||||
{
|
||||
btDefaultMotionState* myMotionState = (btDefaultMotionState*)colObj->m_userObjectPointer;
|
||||
myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(m);
|
||||
} else
|
||||
{
|
||||
colObj->m_worldTransform.getOpenGLMatrix(m);
|
||||
}
|
||||
|
||||
btVector3 wireColor(1.f,1.0f,0.5f); //wants deactivation
|
||||
if (i & 1)
|
||||
@@ -798,3 +811,27 @@ void DemoApplication::renderme()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DemoApplication::clientResetScene()
|
||||
{
|
||||
int numObjects = m_dynamicsWorld->getNumCollisionObjects();
|
||||
|
||||
for (int i=0;i<numObjects;i++)
|
||||
{
|
||||
btCollisionObject* colObj = m_dynamicsWorld->getCollisionObjectArray()[i];
|
||||
|
||||
if (colObj->m_userObjectPointer)
|
||||
{
|
||||
btDefaultMotionState* myMotionState = (btDefaultMotionState*)colObj->m_userObjectPointer;
|
||||
myMotionState->m_graphicsWorldTrans = myMotionState->m_startWorldTrans;
|
||||
colObj->m_worldTransform = myMotionState->m_graphicsWorldTrans;
|
||||
colObj->m_interpolationWorldTransform = myMotionState->m_startWorldTrans;
|
||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||
if (body && !body->isStaticObject())
|
||||
{
|
||||
btRigidBody::upcast(colObj)->setLinearVelocity(btVector3(0,0,0));
|
||||
btRigidBody::upcast(colObj)->setAngularVelocity(btVector3(0,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user