diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-04-11 06:50:02 +0400 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-04-11 06:50:02 +0400 |
commit | ae9233a5b05ebfc925fd542afbdb3bb9220ed65c (patch) | |
tree | 46ed278ee54325ca98540163edf9ea5dd4a88c7f /source/gameengine/Physics/Sumo/Fuzzics | |
parent | d3e88eae711e2fd5d678ed555268647e28a9fc18 (diff) |
1. Check material names passed to the physics engine (for collision sensors.)
Consider:
gameobj->getClientInfo()->m_auxilary_info = (matname ? (void*)(matname+2) : NULL);
It works if matname is "MAblah", but not if matname is "".
2. Added constructor for struct RAS_CameraData.
3. Added initializers to the struct KX_ClientObjectInfo constructor
4. Collision sensors won't detect near sensors.
5. A stack of minor tweaks, adjusting whitespace, using ++it for stl stuff.
Diffstat (limited to 'source/gameengine/Physics/Sumo/Fuzzics')
-rw-r--r-- | source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp | 36 | ||||
-rw-r--r-- | source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp | 10 |
2 files changed, 39 insertions, 7 deletions
diff --git a/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp b/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp index ee8a7da953c..fb02091d4f9 100644 --- a/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp +++ b/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp @@ -374,6 +374,8 @@ DT_Bool SM_Object::boing( if (obj2->isDynamic()) obj2->dynamicCollision(local2, -normal, dist, -rel_vel, restitution, friction_factor, invMass); + //fix(client_data, (void*) obj1, (void*) obj2, coll_data); + return DT_CONTINUE; } @@ -411,6 +413,9 @@ DT_Bool SM_Object::fix( MT_Point3 local1(p1), local2(p2); // Get collision data from SOLID MT_Vector3 normal(local2 - local1); + + if (normal.dot(normal) < MT_EPSILON) + return DT_CONTINUE; // This distinction between dynamic and non-dynamic objects should not be // necessary. Non-dynamic objects are assumed to have infinite mass. @@ -439,7 +444,7 @@ DT_Bool SM_Object::fix( MT_Scalar rel_vel_normal = -0.99*(normal.dot(rel_vel)); obj2->addLinearVelocity(rel_vel_normal*normal); - } + } } return DT_CONTINUE; @@ -461,9 +466,34 @@ void SM_Object::relax(void) notifyClient(); } -SM_Object::SM_Object( -) { +SM_Object::SM_Object() : + m_dynamicParent(0), + m_client_object(0), + + m_shape(0), + m_materialProps(0), + m_materialPropsBackup(0), + m_shapeProps(0), + m_shapePropsBackup(0), + m_object(0), + m_margin(0.0), + m_scaling(1.0, 1.0, 1.0), + m_reaction_impulse(0.0, 0.0, 0.0), + m_reaction_force(0.0, 0.0, 0.0), + m_kinematic(false), + m_prev_kinematic(false), + m_is_rigid_body(false), + m_lin_mom(0.0, 0.0, 0.0), + m_ang_mom(0.0, 0.0, 0.0), + m_force(0.0, 0.0, 0.0), + m_torque(0.0, 0.0, 0.0), + m_error(0.0, 0.0, 0.0), + m_combined_lin_vel (0.0, 0.0, 0.0), + m_combined_ang_vel (0.0, 0.0, 0.0), + m_fh_object(0) +{ // warning no initialization of variables done by moto. + std::cout << "SM_Object::SM_Object()" << std::endl; } SM_Object:: diff --git a/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp b/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp index 38c2b48e460..f7057fecb6e 100644 --- a/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp +++ b/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp @@ -162,8 +162,8 @@ void SM_Scene::remove(SM_Object& object) { void SM_Scene::proceed(MT_Scalar timeStep, MT_Scalar subSampling) { // Don't waste time...but it's OK to spill a little. - if (timeStep < 0.001) - return; + //if (timeStep < 0.001) + // return; // Divide the timeStep into a number of subsamples of size roughly // equal to subSampling (might be a little smaller). @@ -208,14 +208,16 @@ void SM_Scene::proceed(MT_Scalar timeStep, MT_Scalar subSampling) { #if 0 clearObjectCombinedVelocities(); #endif - if (DT_Test(m_scene, m_fixRespTable)) +/* if (DT_Test(m_scene, m_fixRespTable)) for (i = m_objectList.begin(); i != m_objectList.end(); ++i) - (*i)->relax(); + (*i)->relax(); */ + DT_Test(m_scene, m_fixRespTable); // Finish this timestep by saving al state information for the next // timestep and clearing the accumulated forces. for (i = m_objectList.begin(); i != m_objectList.end(); ++i) { + (*i)->relax(); (*i)->proceedKinematic(timeStep); (*i)->saveReactionForce(timeStep); (*i)->clearForce(); |