small cleanup in the DemoApplication, removed references to obsolete PHY_ShapeProps/PHY_MaterialProps
removed deletion of motionstate in CcdPhysics/CcdPhysicsController destructor disabled m_type optimization in SimdTransform (making the memory size 64 byte, potentially more cache friendly) fixed a bug in island generation, causing the activation not propagating in one frame, but one 'layer' of rigidbodies at a time
This commit is contained in:
@@ -612,43 +612,19 @@ CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic,
|
||||
|
||||
startTransforms[numObjects] = startTransform;
|
||||
|
||||
PHY_ShapeProps shapeProps;
|
||||
|
||||
shapeProps.m_do_anisotropic = false;
|
||||
shapeProps.m_do_fh = false;
|
||||
shapeProps.m_do_rot_fh = false;
|
||||
shapeProps.m_friction_scaling[0] = 1.;
|
||||
shapeProps.m_friction_scaling[1] = 1.;
|
||||
shapeProps.m_friction_scaling[2] = 1.;
|
||||
|
||||
shapeProps.m_inertia = 1.f;
|
||||
shapeProps.m_lin_drag = 0.2f;
|
||||
shapeProps.m_ang_drag = 0.1f;
|
||||
shapeProps.m_mass = 10.0f;
|
||||
|
||||
PHY_MaterialProps materialProps;
|
||||
materialProps.m_friction = 10.5f;
|
||||
materialProps.m_restitution = 0.0f;
|
||||
|
||||
CcdConstructionInfo ccdObjectCi;
|
||||
ccdObjectCi.m_friction = 0.5f;
|
||||
|
||||
ccdObjectCi.m_linearDamping = shapeProps.m_lin_drag;
|
||||
ccdObjectCi.m_angularDamping = shapeProps.m_ang_drag;
|
||||
|
||||
|
||||
SimdTransform tr;
|
||||
tr.setIdentity();
|
||||
|
||||
int i = numObjects;
|
||||
{
|
||||
gShapePtr[i] = shape;
|
||||
|
||||
shapeProps.m_shape = gShapePtr[i];
|
||||
shapeProps.m_shape->SetMargin(0.05f);
|
||||
gShapePtr[i]->SetMargin(0.05f);
|
||||
|
||||
SimdQuaternion orn = startTransform.getRotation();
|
||||
|
||||
|
||||
ms[i].setWorldOrientation(orn[0],orn[1],orn[2],orn[3]);
|
||||
ms[i].setWorldPosition(startTransform.getOrigin().getX(),startTransform.getOrigin().getY(),startTransform.getOrigin().getZ());
|
||||
|
||||
@@ -657,25 +633,22 @@ CcdPhysicsController* DemoApplication::LocalCreatePhysicsObject(bool isDynamic,
|
||||
ccdObjectCi.m_localInertiaTensor =SimdVector3(0,0,0);
|
||||
if (!isDynamic)
|
||||
{
|
||||
shapeProps.m_mass = 0.f;
|
||||
ccdObjectCi.m_mass = shapeProps.m_mass;
|
||||
ccdObjectCi.m_mass = 0.f;
|
||||
ccdObjectCi.m_collisionFlags = CollisionObject::isStatic;
|
||||
ccdObjectCi.m_collisionFilterGroup = CcdConstructionInfo::StaticFilter;
|
||||
ccdObjectCi.m_collisionFilterMask = CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter;
|
||||
}
|
||||
else
|
||||
{
|
||||
shapeProps.m_mass = mass;
|
||||
ccdObjectCi.m_mass = shapeProps.m_mass;
|
||||
ccdObjectCi.m_mass = mass;
|
||||
ccdObjectCi.m_collisionFlags = 0;
|
||||
}
|
||||
|
||||
|
||||
SimdVector3 localInertia(0.f,0.f,0.f);
|
||||
|
||||
if (isDynamic)
|
||||
{
|
||||
gShapePtr[i]->CalculateLocalInertia(shapeProps.m_mass,localInertia);
|
||||
gShapePtr[i]->CalculateLocalInertia(ccdObjectCi.m_mass,localInertia);
|
||||
}
|
||||
|
||||
ccdObjectCi.m_localInertiaTensor = localInertia;
|
||||
@@ -727,11 +700,9 @@ void DemoApplication::renderme()
|
||||
|
||||
|
||||
bool isSatEnabled = (getDebugMode() & IDebugDraw::DBG_EnableSatComparison);
|
||||
|
||||
m_physicsEnvironmentPtr->EnableSatCollisionDetection(isSatEnabled);
|
||||
|
||||
|
||||
|
||||
int numPhysicsObjects = m_physicsEnvironmentPtr->GetNumControllers();
|
||||
|
||||
int i;
|
||||
@@ -772,7 +743,7 @@ void DemoApplication::renderme()
|
||||
}
|
||||
|
||||
char extraDebug[125];
|
||||
sprintf(extraDebug,"islId, Body=%i , %i",ctrl->GetRigidBody()->m_islandTag1,ctrl->GetRigidBody()->m_debugBodyId);
|
||||
sprintf(extraDebug,"Island:%i, Body:%i",ctrl->GetRigidBody()->m_islandTag1,ctrl->GetRigidBody()->m_debugBodyId);
|
||||
ctrl->GetRigidBody()->GetCollisionShape()->SetExtraDebugInfo(extraDebug);
|
||||
|
||||
float vec[16];
|
||||
|
||||
Reference in New Issue
Block a user