diff --git a/BulletDynamics/ConstraintSolver/HingeConstraint.cpp b/BulletDynamics/ConstraintSolver/HingeConstraint.cpp index 2534ba73a..c1762c91d 100644 --- a/BulletDynamics/ConstraintSolver/HingeConstraint.cpp +++ b/BulletDynamics/ConstraintSolver/HingeConstraint.cpp @@ -94,7 +94,7 @@ void HingeConstraint::BuildJacobian() void HingeConstraint::SolveConstraint(SimdScalar timeStep) { -#define NEW_IMPLEMENTATION +//#define NEW_IMPLEMENTATION #ifdef NEW_IMPLEMENTATION SimdScalar tau = 0.3f; @@ -164,8 +164,9 @@ void HingeConstraint::SolveConstraint(SimdScalar timeStep) SimdScalar jacDiagABInv0 = 1.f / m_jacAng[0].getDiagonal(); SimdScalar rel_vel0 = m_jacAng[0].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, m_rbB.getLinearVelocity(),angvelB); + float tau1 = tau;//0.f; - SimdScalar impulse0 = (tau * axisB.dot(jointAxis1) / timeStep - damping * rel_vel0) * jacDiagABInv0; + SimdScalar impulse0 = (tau1 * axisB.dot(jointAxis1) / timeStep - damping * rel_vel0) * jacDiagABInv0; SimdVector3 angular_impulse0 = jointAxis0 * impulse0; m_rbA.applyTorqueImpulse( angular_impulse0); @@ -181,7 +182,7 @@ void HingeConstraint::SolveConstraint(SimdScalar timeStep) SimdScalar rel_vel1 = m_jacAng[1].getRelativeVelocity(m_rbA.getLinearVelocity(),angvelA, m_rbB.getLinearVelocity(),angvelB);; - SimdScalar impulse1 = -(tau * axisB.dot(jointAxis0) / timeStep + damping * rel_vel1) * jacDiagABInv1; + SimdScalar impulse1 = -(tau1 * axisB.dot(jointAxis0) / timeStep + damping * rel_vel1) * jacDiagABInv1; SimdVector3 angular_impulse1 = jointAxis1 * impulse1; m_rbA.applyTorqueImpulse( angular_impulse1); diff --git a/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp b/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp index 7ddb1c089..02b6750ea 100644 --- a/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp +++ b/Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp @@ -71,7 +71,7 @@ extern int glutScreenHeight; #ifdef _DEBUG -const int numObjects = 120;//22; +const int numObjects = 22; #else const int numObjects = 120; #endif @@ -285,46 +285,35 @@ int main(int argc,char** argv) } - //create a constraint - if (createConstraint) + clientResetScene(); + { //physObjects[i]->SetAngularVelocity(0,0,-2,true); int constraintId; - float pivotX=CUBE_HALF_EXTENTS, - pivotY=-CUBE_HALF_EXTENTS, - pivotZ=CUBE_HALF_EXTENTS; - - float axisX=1,axisY=0,axisZ=0; + float pivotX=CUBE_HALF_EXTENTS, + pivotY=CUBE_HALF_EXTENTS, + pivotZ=CUBE_HALF_EXTENTS; + float axisX=0,axisY=1,axisZ=0; - - HingeConstraint* hinge = 0; - - SimdVector3 pivotInA(CUBE_HALF_EXTENTS,-CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS); - SimdVector3 pivotInB(-CUBE_HALF_EXTENTS,-CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS); - SimdVector3 axisInA(0,1,0); - SimdVector3 axisInB(0,-1,0); - - RigidBody* rb0 = physObjects[1]->GetRigidBody(); - RigidBody* rb1 = physObjects[2]->GetRigidBody(); - - hinge = new HingeConstraint( - *rb0, - *rb1,pivotInA,pivotInB,axisInA,axisInB); - - physicsEnvironmentPtr->m_constraints.push_back(hinge); - - hinge->SetUserConstraintId(100); - hinge->SetUserConstraintType(PHY_LINEHINGE_CONSTRAINT); + constraintId =physicsEnvironmentPtr->createConstraint( + physObjects[1], + //0, + physObjects[2], + ////PHY_POINT2POINT_CONSTRAINT, + PHY_GENERIC_6DOF_CONSTRAINT,//can leave any of the 6 degree of freedom 'free' or 'locked' + //PHY_LINEHINGE_CONSTRAINT, + pivotX,pivotY,pivotZ, + axisX,axisY,axisZ + ); } + - clientResetScene(); - setCameraDistance(26.f); return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://www.continuousphysics.com/Bullet/phpBB2/"); diff --git a/Demos/ColladaDemo/ColladaDemo.cpp b/Demos/ColladaDemo/ColladaDemo.cpp index bc8974a18..06424974d 100644 --- a/Demos/ColladaDemo/ColladaDemo.cpp +++ b/Demos/ColladaDemo/ColladaDemo.cpp @@ -47,7 +47,7 @@ extern int gForwardAxis; #include "GLDebugDrawer.h" //either FCollada or COLLADA_DOM -//#define USE_FCOLLADA 1 +#define USE_FCOLLADA 1 #ifdef USE_FCOLLADA //Collada Physics test @@ -1088,6 +1088,23 @@ int main(int argc,char** argv) if (geom->getConvex_mesh()) { + { + const domConvex_meshRef convexRef = geom->getConvex_mesh(); + daeElementRef otherElemRef = convexRef->getConvex_hull_of().getElement(); + if ( otherElemRef != NULL ) + { + domGeometryRef linkedGeom = *(domGeometryRef*)&otherElemRef; + printf( "otherLinked\n"); + } else + { + printf("convexMesh polyCount = %i\n",convexRef->getPolygons_array().getCount()); + printf("convexMesh triCount = %i\n",convexRef->getTriangles_array().getCount()); + + } + } + + + ConvexHullShape* convexHullShape = new ConvexHullShape(0,0); //it is quite a trick to get to the vertices, using Collada.