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>2009-05-24 10:31:47 +0400
committerErwin Coumans <blender@erwincoumans.com>2009-05-24 10:31:47 +0400
commit83bb096f24cb2252f90a77923bd1818930a2fed2 (patch)
treefd8c0854fac0f9d5bc830ab64fbfc0a1c4c181e6 /source/gameengine/Physics
parent45f2463c833577852b2c9d3c85e435fc25b945bd (diff)
+ renamed pad3 to m_contactProcessingThreshold (thanks Campbell Barton/ideasman for confirming it is ok to rename it)
+ fixed Python method, PyArg_ParseTuple already checks for errors, no returning of NULL, thanks Campbell too) + added linear/angular spring for each of the 6DOFs of a generic 6dof constraint. This makes the generic 6dof constraint very versatile.
Diffstat (limited to 'source/gameengine/Physics')
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 561c370854f..58720c8cc30 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -922,7 +922,7 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint(
bool useReferenceFrameA = true;
- genericConstraint = new btGeneric6DofConstraint(
+ genericConstraint = new btGeneric6DofSpringConstraint(
*rb0,*rb1,
frameInA,frameInB,useReferenceFrameA);
genericConstraint->setLinearLowerLimit(linearMinLimits);
@@ -1831,6 +1831,28 @@ void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float
break;
}
+ case 12: case 13: case 14: case 15: case 16: case 17:
+ {
+ //param 13-17 are for motorized springs on each of the degrees of freedom
+ btGeneric6DofSpringConstraint* genCons = (btGeneric6DofSpringConstraint*)typedConstraint;
+ int springIndex = param-12;
+ if (value0!=0.f)
+ {
+ bool springEnabled = true;
+ genCons->setStiffness(springIndex,value0);
+ genCons->enableSpring(springIndex,springEnabled);
+ if (value1>0.5f)
+ {
+ genCons->setEquilibriumPoint(springIndex);
+ }
+ } else
+ {
+ bool springEnabled = false;
+ genCons->enableSpring(springIndex,springEnabled);
+ }
+ break;
+ }
+
default:
{
}
@@ -2351,7 +2373,7 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
frameInB = inv * globalFrameA;
bool useReferenceFrameA = true;
- genericConstraint = new btGeneric6DofConstraint(
+ genericConstraint = new btGeneric6DofSpringConstraint(
*rb0,*rb1,
frameInA,frameInB,useReferenceFrameA);
@@ -2375,7 +2397,7 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
frameInB = rb0->getCenterOfMassTransform() * frameInA;
bool useReferenceFrameA = true;
- genericConstraint = new btGeneric6DofConstraint(
+ genericConstraint = new btGeneric6DofSpringConstraint(
*rb0,s_fixedObject2,
frameInA,frameInB,useReferenceFrameA);
}