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:
ejcoumans
2006-10-18 03:28:42 +00:00
parent 1fe414d98a
commit 3a6942fb91
32 changed files with 406 additions and 185 deletions

View File

@@ -21,8 +21,9 @@ btCollisionObject::btCollisionObject()
m_collisionFlags(0),
m_activationState1(1),
m_deactivationTime(0.f),
m_userObjectPointer(0),
m_hitFraction(1.f),
m_ccdSweptShereRadius(0.f),
m_ccdSweptSphereRadius(0.f),
m_ccdSquareMotionTreshold(0.f)
{

View File

@@ -27,6 +27,9 @@ subject to the following restrictions:
struct btBroadphaseProxy;
class btCollisionShape;
#include "LinearMath/btMotionState.h"
/// btCollisionObject can be used to manage collision detection objects.
/// btCollisionObject maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy.
@@ -68,7 +71,7 @@ struct btCollisionObject
float m_hitFraction;
///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
float m_ccdSweptShereRadius;
float m_ccdSweptSphereRadius;
/// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionTreshold
float m_ccdSquareMotionTreshold;

View File

@@ -271,12 +271,12 @@ float btConvexConcaveCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject
rayAabbMin.setMin(convexToLocal.getOrigin());
btVector3 rayAabbMax = convexFromLocal.getOrigin();
rayAabbMax.setMax(convexToLocal.getOrigin());
rayAabbMin -= btVector3(convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius);
rayAabbMax += btVector3(convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius,convexbody->m_ccdSweptShereRadius);
rayAabbMin -= btVector3(convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius);
rayAabbMax += btVector3(convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius);
float curHitFraction = 1.f; //is this available?
LocalTriangleSphereCastCallback raycastCallback(convexFromLocal,convexToLocal,
convexbody->m_ccdSweptShereRadius,curHitFraction);
convexbody->m_ccdSweptSphereRadius,curHitFraction);
raycastCallback.m_hitFraction = convexbody->m_hitFraction;

View File

@@ -214,7 +214,7 @@ float btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btC
{
btConvexShape* convex0 = static_cast<btConvexShape*>(col0->m_collisionShape);
btSphereShape sphere1(col1->m_ccdSweptShereRadius); //todo: allow non-zero sphere sizes, for better approximation
btSphereShape sphere1(col1->m_ccdSweptSphereRadius); //todo: allow non-zero sphere sizes, for better approximation
btConvexCast::CastResult result;
btVoronoiSimplexSolver voronoiSimplex;
//SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);
@@ -247,7 +247,7 @@ float btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btC
{
btConvexShape* convex1 = static_cast<btConvexShape*>(col1->m_collisionShape);
btSphereShape sphere0(col0->m_ccdSweptShereRadius); //todo: allow non-zero sphere sizes, for better approximation
btSphereShape sphere0(col0->m_ccdSweptSphereRadius); //todo: allow non-zero sphere sizes, for better approximation
btConvexCast::CastResult result;
btVoronoiSimplexSolver voronoiSimplex;
//SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);