Index: plugins/physics/bullet/bullet.cpp
===================================================================
--- plugins/physics/bullet/bullet.cpp	(revisión: 31580)
+++ plugins/physics/bullet/bullet.cpp	(copia de trabajo)
@@ -1529,7 +1529,7 @@
   angular_constraints_axis[1].Set (0, 0, 1);
 
   desired_velocity.Set (0, 0, 0);
-  maxforce.Set (0, 0, 0);
+  maxforce.Set (0,  0, 0);
   bounce.Set (0, 0, 0);
 }
 
@@ -1595,17 +1595,48 @@
 	frA.setIdentity ();
 	frB.setIdentity ();
 
+        //frA = body1->getWorldTransform ().invXform (jointPoint);
+        //frB = body2->getWorldTransform ().invXform (jointPoint);
         frA.setOrigin (body1->getWorldTransform ().invXform (jointPoint));
         frB.setOrigin (body2->getWorldTransform ().invXform (jointPoint));
 
 	btGeneric6DofConstraint* dof6;
 	dof6 = new btGeneric6DofConstraint (*body1, *body2,
-	    frA, frB, true);
-	dof6->setLinearLowerLimit (btVector3 (0, 0, 0));
-	dof6->setLinearUpperLimit (btVector3 (0, 0, 0));
-	dof6->setAngularLowerLimit (btVector3 (0, 0, 0));
-	dof6->setAngularUpperLimit (btVector3 (0, 0, 0));
+	    frA, frB, false);
+	dof6->setLinearLowerLimit (btVector3 (min_dist[0],min_dist[1],min_dist[2]));
+	dof6->setLinearUpperLimit (btVector3 (max_dist[0],max_dist[1],max_dist[2]));
+	dof6->setAngularLowerLimit (btVector3 (min_angle[0],min_angle[1],min_angle[2]));
+	dof6->setAngularUpperLimit (btVector3 (max_angle[0],max_angle[1],max_angle[2]));
+        if (maxforce[0])
+        {
+          dof6->getRotationalLimitMotor(0)->m_targetVelocity = desired_velocity[0];
+          dof6->getRotationalLimitMotor(0)->m_maxMotorForce = maxforce[0];
+          dof6->getRotationalLimitMotor(0)->m_maxLimitForce = maxforce[0]*2.0;
+          dof6->getRotationalLimitMotor(0)->m_bounce = bounce[0];
+          //dof6->getRotationalLimitMotor(0)->m_limitSoftness = 0.01;
+          dof6->getRotationalLimitMotor(0)->m_enableMotor = true;
+        }
+        if (maxforce[1])
+        {
+          dof6->getRotationalLimitMotor(1)->m_targetVelocity = desired_velocity[1];
+          dof6->getRotationalLimitMotor(1)->m_maxMotorForce = maxforce[1];
+          dof6->getRotationalLimitMotor(1)->m_maxLimitForce = maxforce[1]*2.0;
+          dof6->getRotationalLimitMotor(1)->m_bounce = bounce[1];
+          //dof6->getRotationalLimitMotor(1)->m_limitSoftness = 0.01;
+          dof6->getRotationalLimitMotor(1)->m_enableMotor = true;
+        }
+        if (maxforce[2])
+        {
+          dof6->getRotationalLimitMotor(2)->m_maxLimitForce = maxforce[2]*2.0;
+          dof6->getRotationalLimitMotor(2)->m_targetVelocity = desired_velocity[2];
+          dof6->getRotationalLimitMotor(2)->m_maxMotorForce = maxforce[2];
+          dof6->getRotationalLimitMotor(2)->m_bounce = bounce[2];
+          //dof6->getRotationalLimitMotor(2)->m_limitSoftness = 0.01;
+          dof6->getRotationalLimitMotor(2)->m_enableMotor = true;
+        }
+
 	constraint = dof6;
+        printf("create joint!!\n");
       }
       break;
 
@@ -1662,31 +1693,71 @@
 void csBulletJoint::SetMinimumAngle (const csVector3& min, bool force_update)
 {
   min_angle = min;
-  RecreateJointIfNeeded ();
+  RecreateJointIfNeeded (force_update);
+  if (constraint && current_type == BULLET_JOINT_6DOF)
+  {
+	btGeneric6DofConstraint* dof6;
+	dof6 = (btGeneric6DofConstraint *)constraint;
+        dof6->getRotationalLimitMotor(0)->m_loLimit = min[0];
+        dof6->getRotationalLimitMotor(1)->m_loLimit = min[1];
+        dof6->getRotationalLimitMotor(2)->m_loLimit = min[2];
+  }
 }
 
 void csBulletJoint::SetMaximumAngle (const csVector3& max, bool force_update)
 {
   max_angle = max;
-  RecreateJointIfNeeded ();
+  RecreateJointIfNeeded (force_update);
+  if (constraint && current_type == BULLET_JOINT_6DOF)
+  {
+	btGeneric6DofConstraint* dof6;
+	dof6 = (btGeneric6DofConstraint *)constraint;
+        dof6->getRotationalLimitMotor(0)->m_hiLimit = max[0];
+        dof6->getRotationalLimitMotor(1)->m_hiLimit = max[1];
+        dof6->getRotationalLimitMotor(2)->m_hiLimit = max[2];
+  }
 }
 
 void csBulletJoint::SetBounce (const csVector3& bounce, bool force_update)
 {
   csBulletJoint::bounce = bounce;
   RecreateJointIfNeeded ();
+  if (constraint && current_type == BULLET_JOINT_6DOF)
+  {
+	btGeneric6DofConstraint* dof6;
+	dof6 = (btGeneric6DofConstraint *)constraint;
+        dof6->getRotationalLimitMotor(0)->m_bounce = bounce[0];
+        dof6->getRotationalLimitMotor(1)->m_bounce = bounce[1];
+        dof6->getRotationalLimitMotor(2)->m_bounce = bounce[2];
+  }
 }
 
 void csBulletJoint::SetDesiredVelocity (const csVector3& velocity, bool force_update)
 {
   desired_velocity = velocity;
-  RecreateJointIfNeeded ();
+  RecreateJointIfNeeded (force_update);
+  if (constraint && current_type == BULLET_JOINT_6DOF)
+  {
+	btGeneric6DofConstraint* dof6;
+	dof6 = (btGeneric6DofConstraint *)constraint;
+        dof6->getRotationalLimitMotor(0)->m_targetVelocity = velocity[0];
+        dof6->getRotationalLimitMotor(1)->m_targetVelocity = velocity[1];
+        dof6->getRotationalLimitMotor(2)->m_targetVelocity = velocity[2];
+  }
 }
 
 void csBulletJoint::SetMaxForce (const csVector3& maxForce, bool force_update)
 {
   maxforce = maxForce;
-  RecreateJointIfNeeded ();
+  RecreateJointIfNeeded (force_update);
+  if (constraint && current_type == BULLET_JOINT_6DOF)
+  {
+	btGeneric6DofConstraint* dof6;
+	dof6 = (btGeneric6DofConstraint *)constraint;
+        dof6->getRotationalLimitMotor(0)->m_maxMotorForce = maxForce[0];
+        dof6->getRotationalLimitMotor(1)->m_maxMotorForce = maxForce[1];
+        dof6->getRotationalLimitMotor(2)->m_maxMotorForce = maxForce[2];
+  }
 }
 
 void csBulletJoint::SetAngularConstraintAxis (const csVector3& axis,
