Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-12-02 06:48:36 +0300
committerErwin Coumans <blender@erwincoumans.com>2006-12-02 06:48:36 +0300
commit28bbf2d61616f7b8b3c59b54b46af7ee4dbf1e11 (patch)
tree942f1211d5d0bb2f4ceaa6f08e3718f21c942dbb /source/gameengine/Converter
parentbcb3aec646ad197874ceaf1ed535251e536cb3fd (diff)
- added support for generic 6DOF constraint
- only 6DOF constraint shows buttons for limits - added python support for rigidbody constraint (untested, but required for COLLADA Physics support)
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index b8e273f3d19..2432462fecc 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1939,12 +1939,37 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) {
if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){
bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data;
- if (dat->tar)
+ //if (dat->tar)
if (!dat->child){
- KX_GameObject *gotar=getGameOb(dat->tar->id.name,sumolist);
+ PHY_IPhysicsController* physctr2 = 0;
+ if (dat->tar)
+ {
+ KX_GameObject *gotar=getGameOb(dat->tar->id.name,sumolist);
+ physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
+ }
+
PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData();
- PHY_IPhysicsController* physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
- 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);
+
+ 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)
+ {
+ int dof;
+ int dofbit=1;
+ for (dof=0;dof<6;dof++)
+ {
+ 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;
+ }
+ }
+
}
}
}