diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-12-03 01:25:47 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-12-03 01:25:47 +0300 |
commit | 438d114f1ac3c8eaa4c1d9d8ffa31271a51c85e6 (patch) | |
tree | 030c8c62a46ed0b3a527eb7cc25e277e303c59f5 /source/gameengine/Converter/BL_BlenderDataConversion.cpp | |
parent | 08ef0d346653bbe746231fdd3c94b5b3313a84a5 (diff) |
- GEadded VSYNC for Mac OS X swapbuffers (can be easily undone by commenting out the #define WAIT_FOR_VSYNC 1
- GEdon't crash when attempting to add constraint on game objects without physics controller
- GEimproved some physics -> graphics synchronization issues
- small experiment with game engine timing to smooth framerate/reduce tearing
Diffstat (limited to 'source/gameengine/Converter/BL_BlenderDataConversion.cpp')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 2432462fecc..03af40ce2c9 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1947,29 +1947,31 @@ void BL_ConvertBlenderObjects(struct Main* maggie, KX_GameObject *gotar=getGameOb(dat->tar->id.name,sumolist); physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData(); } - - PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData(); - - int constraintId = kxscene->GetPhysicsEnvironment()->createConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX,(float)dat->pivY,(float)dat->pivZ,(float)dat->axX,(float)dat->axY,(float)dat->axZ); - //if it is a generic 6DOF constraint, set all the limits accordingly - if (dat->type == PHY_GENERIC_6DOF_CONSTRAINT) + + if (gameobj->GetPhysicsController()) { - int dof; - int dofbit=1; - for (dof=0;dof<6;dof++) + PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData(); + + int constraintId = kxscene->GetPhysicsEnvironment()->createConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX,(float)dat->pivY,(float)dat->pivZ,(float)dat->axX,(float)dat->axY,(float)dat->axZ); + //if it is a generic 6DOF constraint, set all the limits accordingly + if (dat->type == PHY_GENERIC_6DOF_CONSTRAINT) { - if (dat->flag & dofbit) - { - kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]); - } else + int dof; + int dofbit=1; + for (dof=0;dof<6;dof++) { - //minLimit > maxLimit means free(disabled limit) for this degree of freedom - kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1); + if (dat->flag & dofbit) + { + kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]); + } else + { + //minLimit > maxLimit means free(disabled limit) for this degree of freedom + kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1); + } + dofbit<<=1; } - dofbit<<=1; } } - } } } |