Commit: eaabe9d6c6099773f85c600480206fc97934824e
Author: Thomas Szepe
Date:   Thu Feb 26 20:08:22 2015 +0100
Branches: master
https://developer.blender.org/rBeaabe9d6c6099773f85c600480206fc97934824e

BGE: Fix for CreateConstraint API

This patch fix two bugs related to CreateConstraint().
1. Disable linked collision only working with 6DoF constraints.
2. If all pivot axis rotations setted to zero the linked object disappears.

{F101374}

Reviewers: moguri, sybren, brita_, lordloki

Reviewed By: lordloki

Subscribers: p9ablo

Differential Revision: https://developer.blender.org/D704

===================================================================

M       source/gameengine/Ketsji/KX_PyConstraintBinding.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp 
b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 51ae5ca..94f5064 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -538,31 +538,24 @@ static PyObject *gPyCreateConstraint(PyObject *self,
                        PHY_IPhysicsController* physctrl2 = 
(PHY_IPhysicsController*) physicsid2;
                        if (physctrl) //TODO:check for existence of this 
pointer!
                        {
-                               PHY_ConstraintType ct = (PHY_ConstraintType) 
constrainttype;
                                int constraintid =0;
 
-                               if (ct == PHY_GENERIC_6DOF_CONSTRAINT)
-                               {
-                                       //convert from euler angle into axis
-                                       float radsPerDeg = 
6.283185307179586232f / 360.f;
-
-                                       //we need to pass a full constraint 
frame, not just axis
-                                       //localConstraintFrameBasis
-                                       MT_Matrix3x3 
localCFrame(MT_Vector3(radsPerDeg*axisX,radsPerDeg*axisY,radsPerDeg*axisZ));
-                                       MT_Vector3 axis0 = 
localCFrame.getColumn(0);
-                                       MT_Vector3 axis1 = 
localCFrame.getColumn(1);
-                                       MT_Vector3 axis2 = 
localCFrame.getColumn(2);
-
-                                       constraintid = 
PHY_GetActiveEnvironment()->CreateConstraint(physctrl,physctrl2,(enum 
PHY_ConstraintType)constrainttype,
-                                                                               
                    pivotX,pivotY,pivotZ,
-                                                                               
                    (float)axis0.x(),(float)axis0.y(),(float)axis0.z(),
-                                                                               
                    (float)axis1.x(),(float)axis1.y(),(float)axis1.z(),
-                                                                               
                    (float)axis2.x(),(float)axis2.y(),(float)axis2.z(),flag);
-                               }
-                               else {
-                                       constraintid = 
PHY_GetActiveEnvironment()->CreateConstraint(physctrl,physctrl2,(enum 
PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ,0);
-                               }
-                               
+                               //convert from euler angle into axis
+                               float radsPerDeg = 6.283185307179586232f / 
360.f;
+
+                               //we need to pass a full constraint frame, not 
just axis
+                               //localConstraintFrameBasis
+                               MT_Matrix3x3 
localCFrame(MT_Vector3(radsPerDeg*axisX,radsPerDeg*axisY,radsPerDeg*axisZ));
+                               MT_Vector3 axis0 = localCFrame.getColumn(0);
+                               MT_Vector3 axis1 = localCFrame.getColumn(1);
+                               MT_Vector3 axis2 = localCFrame.getColumn(2);
+
+                               constraintid = 
PHY_GetActiveEnvironment()->CreateConstraint(physctrl,physctrl2,(enum 
PHY_ConstraintType)constrainttype,
+                                                                               
            pivotX,pivotY,pivotZ,
+                                                                               
            (float)axis0.x(),(float)axis0.y(),(float)axis0.z(),
+                                                                               
            (float)axis1.x(),(float)axis1.y(),(float)axis1.z(),
+                                                                               
            (float)axis2.x(),(float)axis2.y(),(float)axis2.z(),flag);
+
                                KX_ConstraintWrapper* wrap = new 
KX_ConstraintWrapper((enum 
PHY_ConstraintType)constrainttype,constraintid,PHY_GetActiveEnvironment());
 
                                return wrap->NewProxy(true);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to