aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2013-08-07 07:54:47 -0700
committerRobert Adams2013-09-11 09:11:36 -0700
commit48ee73bfa771de64685a694417b34188f0a3350e (patch)
treec392992c72b4c5facdba20f6e175881850a9bd56 /OpenSim
parentBulletSim: fixes for change linkset implementation of physical linksets. (diff)
downloadopensim-SC-48ee73bfa771de64685a694417b34188f0a3350e.zip
opensim-SC-48ee73bfa771de64685a694417b34188f0a3350e.tar.gz
opensim-SC-48ee73bfa771de64685a694417b34188f0a3350e.tar.bz2
opensim-SC-48ee73bfa771de64685a694417b34188f0a3350e.tar.xz
BulletSim: add API and calls for spring constraint parameters.
Diffstat (limited to 'OpenSim')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs36
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs38
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs8
3 files changed, 82 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
index 12a0c17..6c36485 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -596,6 +596,30 @@ public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, flo
596 return BSAPICPP.SetBreakingImpulseThreshold2(constrainu.ptr, threshold); 596 return BSAPICPP.SetBreakingImpulseThreshold2(constrainu.ptr, threshold);
597} 597}
598 598
599public override bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse)
600{
601 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
602 return BSAPICPP.ConstraintSpringEnable2(constrainu.ptr, index, numericTrueFalse);
603}
604
605public override bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint)
606{
607 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
608 return BSAPICPP.ConstraintSpringSetEquilibriumPoint2(constrainu.ptr, index, equilibriumPoint);
609}
610
611public override bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss)
612{
613 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
614 return BSAPICPP.ConstraintSpringSetStiffness2(constrainu.ptr, index, stiffnesss);
615}
616
617public override bool SpringSetDamping(BulletConstraint constrain, int index, float damping)
618{
619 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
620 return BSAPICPP.ConstraintSpringSetDamping2(constrainu.ptr, index, damping);
621}
622
599public override bool CalculateTransforms(BulletConstraint constrain) 623public override bool CalculateTransforms(BulletConstraint constrain)
600{ 624{
601 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; 625 BulletConstraintUnman constrainu = constrain as BulletConstraintUnman;
@@ -1601,6 +1625,18 @@ public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enabl
1601public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); 1625public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold);
1602 1626
1603[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1627[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1628public static extern bool ConstraintSpringEnable2(IntPtr constrain, int index, float numericTrueFalse);
1629
1630[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1631public static extern bool ConstraintSpringSetEquilibriumPoint2(IntPtr constrain, int index, float equilibriumPoint);
1632
1633[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1634public static extern bool ConstraintSpringSetStiffness2(IntPtr constrain, int index, float stiffness);
1635
1636[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1637public static extern bool ConstraintSpringSetDamping2(IntPtr constrain, int index, float damping);
1638
1639[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1604public static extern bool CalculateTransforms2(IntPtr constrain); 1640public static extern bool CalculateTransforms2(IntPtr constrain);
1605 1641
1606[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1642[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index 2a820be..9ad12a9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -752,6 +752,44 @@ private sealed class BulletConstraintXNA : BulletConstraint
752 constraint.SetBreakingImpulseThreshold(threshold); 752 constraint.SetBreakingImpulseThreshold(threshold);
753 return true; 753 return true;
754 } 754 }
755 public override bool SpringEnable(BulletConstraint pConstraint, int index, float numericTrueFalse)
756 {
757 Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint;
758 constraint.EnableSpring(index, (numericTrueFalse == 0f ? false : true));
759 return true;
760 }
761
762 public override bool SpringSetEquilibriumPoint(BulletConstraint pConstraint, int index, float equilibriumPoint)
763 {
764 Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint;
765 if (index == -1)
766 {
767 constraint.SetEquilibriumPoint();
768 }
769 else
770 {
771 if (equilibriumPoint == -1)
772 constraint.SetEquilibriumPoint(index);
773 else
774 constraint.SetEquilibriumPoint(index, equilibriumPoint);
775 }
776 return true;
777 }
778
779 public override bool SpringSetStiffness(BulletConstraint pConstraint, int index, float stiffness)
780 {
781 Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint;
782 constraint.SetStiffness(index, stiffness);
783 return true;
784 }
785
786 public override bool SpringSetDamping(BulletConstraint pConstraint, int index, float damping)
787 {
788 Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint;
789 constraint.SetDamping(index, damping);
790 return true;
791 }
792
755 //BulletSimAPI.SetAngularDamping(Prim.PhysBody.ptr, angularDamping); 793 //BulletSimAPI.SetAngularDamping(Prim.PhysBody.ptr, angularDamping);
756 public override void SetAngularDamping(BulletBody pBody, float angularDamping) 794 public override void SetAngularDamping(BulletBody pBody, float angularDamping)
757 { 795 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index 6cdc112..8cca29f 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -441,6 +441,14 @@ public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float e
441 441
442public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); 442public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold);
443 443
444public abstract bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse);
445
446public abstract bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint);
447
448public abstract bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss);
449
450public abstract bool SpringSetDamping(BulletConstraint constrain, int index, float damping);
451
444public abstract bool CalculateTransforms(BulletConstraint constrain); 452public abstract bool CalculateTransforms(BulletConstraint constrain);
445 453
446public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); 454public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);