diff options
author | Robert Adams | 2012-12-21 15:21:32 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-21 15:21:32 -0800 |
commit | 6dbf9c8ed4ca5646f47043f9937da5acbe124d0e (patch) | |
tree | 337ec47d2093834ccef03f83816ec3f203315c6f /OpenSim/Region | |
parent | BulletSim: Move all the parameter variables, tables and get and fetch logic t... (diff) | |
download | opensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.zip opensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.tar.gz opensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.tar.bz2 opensim-SC_OLD-6dbf9c8ed4ca5646f47043f9937da5acbe124d0e.tar.xz |
BulletSim: repair vehicle problems introduced in previous 'improvements'. Fix line endings in BSParams.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 37 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs | 14 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 1117 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 2 |
4 files changed, 598 insertions, 572 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index e59ed8d..3fde57b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -634,28 +634,33 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
634 | m_knownHas = 0; | 634 | m_knownHas = 0; |
635 | m_knownChanged = 0; | 635 | m_knownChanged = 0; |
636 | } | 636 | } |
637 | // Push all the changed values back into the physics engine | ||
637 | private void PushKnownChanged() | 638 | private void PushKnownChanged() |
638 | { | 639 | { |
639 | if (m_knownChanged != 0) | 640 | if (m_knownChanged != 0) |
640 | { | 641 | { |
641 | if ((m_knownChanged & m_knownChangedPosition) != 0) | 642 | if ((m_knownChanged & m_knownChangedPosition) != 0) |
642 | Prim.ForcePosition = VehiclePosition; | 643 | Prim.ForcePosition = m_knownPosition; |
644 | |||
643 | if ((m_knownChanged & m_knownChangedOrientation) != 0) | 645 | if ((m_knownChanged & m_knownChangedOrientation) != 0) |
644 | Prim.ForceOrientation = VehicleOrientation; | 646 | Prim.ForceOrientation = m_knownOrientation; |
647 | |||
645 | if ((m_knownChanged & m_knownChangedVelocity) != 0) | 648 | if ((m_knownChanged & m_knownChangedVelocity) != 0) |
646 | { | 649 | { |
647 | Prim.ForceVelocity = VehicleVelocity; | 650 | Prim.ForceVelocity = m_knownVelocity; |
648 | BulletSimAPI.SetInterpolationLinearVelocity2(Prim.PhysBody.ptr, VehicleVelocity); | 651 | BulletSimAPI.SetInterpolationLinearVelocity2(Prim.PhysBody.ptr, VehicleVelocity); |
649 | } | 652 | } |
653 | |||
650 | if ((m_knownChanged & m_knownChangedForce) != 0) | 654 | if ((m_knownChanged & m_knownChangedForce) != 0) |
651 | Prim.AddForce((Vector3)m_knownForce, false, true); | 655 | Prim.AddForce((Vector3)m_knownForce, false, true); |
652 | 656 | ||
653 | if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0) | 657 | if ((m_knownChanged & m_knownChangedRotationalVelocity) != 0) |
654 | { | 658 | { |
655 | Prim.ForceRotationalVelocity = VehicleRotationalVelocity; | 659 | Prim.ForceRotationalVelocity = m_knownRotationalVelocity; |
656 | // Fake out Bullet by making it think the velocity is the same as last time. | 660 | // Fake out Bullet by making it think the velocity is the same as last time. |
657 | BulletSimAPI.SetInterpolationAngularVelocity2(Prim.PhysBody.ptr, VehicleRotationalVelocity); | 661 | BulletSimAPI.SetInterpolationAngularVelocity2(Prim.PhysBody.ptr, m_knownRotationalVelocity); |
658 | } | 662 | } |
663 | |||
659 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) | 664 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) |
660 | Prim.AddAngularForce((Vector3)m_knownRotationalForce, false, true); | 665 | Prim.AddAngularForce((Vector3)m_knownRotationalForce, false, true); |
661 | 666 | ||
@@ -667,7 +672,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
667 | } | 672 | } |
668 | 673 | ||
669 | // Since the computation of terrain height can be a little involved, this routine | 674 | // Since the computation of terrain height can be a little involved, this routine |
670 | // is used ot fetch the height only once for each vehicle simulation step. | 675 | // is used to fetch the height only once for each vehicle simulation step. |
671 | private float GetTerrainHeight(Vector3 pos) | 676 | private float GetTerrainHeight(Vector3 pos) |
672 | { | 677 | { |
673 | if ((m_knownHas & m_knownChangedTerrainHeight) == 0) | 678 | if ((m_knownHas & m_knownChangedTerrainHeight) == 0) |
@@ -699,12 +704,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
699 | m_knownPosition = Prim.ForcePosition; | 704 | m_knownPosition = Prim.ForcePosition; |
700 | m_knownHas |= m_knownChangedPosition; | 705 | m_knownHas |= m_knownChangedPosition; |
701 | } | 706 | } |
702 | return (Vector3)m_knownPosition; | 707 | return m_knownPosition; |
703 | } | 708 | } |
704 | set | 709 | set |
705 | { | 710 | { |
706 | m_knownPosition = value; | 711 | m_knownPosition = value; |
707 | m_knownChanged |= m_knownChangedPosition; | 712 | m_knownChanged |= m_knownChangedPosition; |
713 | m_knownHas |= m_knownChangedPosition; | ||
708 | } | 714 | } |
709 | } | 715 | } |
710 | 716 | ||
@@ -717,12 +723,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
717 | m_knownOrientation = Prim.ForceOrientation; | 723 | m_knownOrientation = Prim.ForceOrientation; |
718 | m_knownHas |= m_knownChangedOrientation; | 724 | m_knownHas |= m_knownChangedOrientation; |
719 | } | 725 | } |
720 | return (Quaternion)m_knownOrientation; | 726 | return m_knownOrientation; |
721 | } | 727 | } |
722 | set | 728 | set |
723 | { | 729 | { |
724 | m_knownOrientation = value; | 730 | m_knownOrientation = value; |
725 | m_knownChanged |= m_knownChangedOrientation; | 731 | m_knownChanged |= m_knownChangedOrientation; |
732 | m_knownHas |= m_knownChangedOrientation; | ||
726 | } | 733 | } |
727 | } | 734 | } |
728 | 735 | ||
@@ -741,13 +748,19 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
741 | { | 748 | { |
742 | m_knownVelocity = value; | 749 | m_knownVelocity = value; |
743 | m_knownChanged |= m_knownChangedVelocity; | 750 | m_knownChanged |= m_knownChangedVelocity; |
751 | m_knownHas |= m_knownChangedVelocity; | ||
744 | } | 752 | } |
745 | } | 753 | } |
746 | 754 | ||
747 | private void VehicleAddForce(Vector3 aForce) | 755 | private void VehicleAddForce(Vector3 aForce) |
748 | { | 756 | { |
757 | if ((m_knownHas & m_knownChangedForce) == 0) | ||
758 | { | ||
759 | m_knownForce = Vector3.Zero; | ||
760 | } | ||
749 | m_knownForce += aForce; | 761 | m_knownForce += aForce; |
750 | m_knownChanged |= m_knownChangedForce; | 762 | m_knownChanged |= m_knownChangedForce; |
763 | m_knownHas |= m_knownChangedForce; | ||
751 | } | 764 | } |
752 | 765 | ||
753 | private Vector3 VehicleRotationalVelocity | 766 | private Vector3 VehicleRotationalVelocity |
@@ -765,12 +778,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
765 | { | 778 | { |
766 | m_knownRotationalVelocity = value; | 779 | m_knownRotationalVelocity = value; |
767 | m_knownChanged |= m_knownChangedRotationalVelocity; | 780 | m_knownChanged |= m_knownChangedRotationalVelocity; |
781 | m_knownHas |= m_knownChangedRotationalVelocity; | ||
768 | } | 782 | } |
769 | } | 783 | } |
770 | private void VehicleAddAngularForce(Vector3 aForce) | 784 | private void VehicleAddAngularForce(Vector3 aForce) |
771 | { | 785 | { |
786 | if ((m_knownHas & m_knownChangedRotationalForce) == 0) | ||
787 | { | ||
788 | m_knownRotationalForce = Vector3.Zero; | ||
789 | } | ||
772 | m_knownRotationalForce += aForce; | 790 | m_knownRotationalForce += aForce; |
773 | m_knownChanged |= m_knownChangedRotationalForce; | 791 | m_knownChanged |= m_knownChangedRotationalForce; |
792 | m_knownHas |= m_knownChangedRotationalForce; | ||
774 | } | 793 | } |
775 | // Vehicle relative forward velocity | 794 | // Vehicle relative forward velocity |
776 | private Vector3 VehicleForwardVelocity | 795 | private Vector3 VehicleForwardVelocity |
@@ -782,7 +801,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
782 | m_knownForwardVelocity = VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); | 801 | m_knownForwardVelocity = VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); |
783 | m_knownHas |= m_knownChangedForwardVelocity; | 802 | m_knownHas |= m_knownChangedForwardVelocity; |
784 | } | 803 | } |
785 | return (Vector3)m_knownForwardVelocity; | 804 | return m_knownForwardVelocity; |
786 | } | 805 | } |
787 | } | 806 | } |
788 | private float VehicleForwardSpeed | 807 | private float VehicleForwardSpeed |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs index 34a87c6..8781fe9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs | |||
@@ -268,12 +268,14 @@ public class BSPIDVMotor : BSVMotor | |||
268 | public Vector3 proportionFactor { get; set; } | 268 | public Vector3 proportionFactor { get; set; } |
269 | public Vector3 integralFactor { get; set; } | 269 | public Vector3 integralFactor { get; set; } |
270 | public Vector3 derivFactor { get; set; } | 270 | public Vector3 derivFactor { get; set; } |
271 | |||
271 | // Arbritrary factor range. | 272 | // Arbritrary factor range. |
272 | // EfficiencyHigh means move quickly to the correct number. EfficiencyLow means might over correct. | 273 | // EfficiencyHigh means move quickly to the correct number. EfficiencyLow means might over correct. |
273 | public float EfficiencyHigh = 0.4f; | 274 | public float EfficiencyHigh = 0.4f; |
274 | public float EfficiencyLow = 4.0f; | 275 | public float EfficiencyLow = 4.0f; |
275 | 276 | ||
276 | Vector3 IntegralFactor { get; set; } | 277 | // Running integration of the error |
278 | Vector3 RunningIntegration { get; set; } | ||
277 | 279 | ||
278 | public BSPIDVMotor(string useName) | 280 | public BSPIDVMotor(string useName) |
279 | : base(useName) | 281 | : base(useName) |
@@ -281,7 +283,7 @@ public class BSPIDVMotor : BSVMotor | |||
281 | proportionFactor = new Vector3(1.00f, 1.00f, 1.00f); | 283 | proportionFactor = new Vector3(1.00f, 1.00f, 1.00f); |
282 | integralFactor = new Vector3(1.00f, 1.00f, 1.00f); | 284 | integralFactor = new Vector3(1.00f, 1.00f, 1.00f); |
283 | derivFactor = new Vector3(1.00f, 1.00f, 1.00f); | 285 | derivFactor = new Vector3(1.00f, 1.00f, 1.00f); |
284 | IntegralFactor = Vector3.Zero; | 286 | RunningIntegration = Vector3.Zero; |
285 | LastError = Vector3.Zero; | 287 | LastError = Vector3.Zero; |
286 | } | 288 | } |
287 | 289 | ||
@@ -312,14 +314,18 @@ public class BSPIDVMotor : BSVMotor | |||
312 | public override Vector3 Step(float timeStep, Vector3 error) | 314 | public override Vector3 Step(float timeStep, Vector3 error) |
313 | { | 315 | { |
314 | // Add up the error so we can integrate over the accumulated errors | 316 | // Add up the error so we can integrate over the accumulated errors |
315 | IntegralFactor += error * timeStep; | 317 | RunningIntegration += error * timeStep; |
316 | 318 | ||
317 | // A simple derivitive is the rate of change from the last error. | 319 | // A simple derivitive is the rate of change from the last error. |
318 | Vector3 derivFactor = (error - LastError) * timeStep; | 320 | Vector3 derivFactor = (error - LastError) * timeStep; |
319 | LastError = error; | 321 | LastError = error; |
320 | 322 | ||
321 | // Correction = -(proportionOfPresentError + accumulationOfPastError + rateOfChangeOfError) | 323 | // Correction = -(proportionOfPresentError + accumulationOfPastError + rateOfChangeOfError) |
322 | Vector3 ret = -(error * proportionFactor + IntegralFactor * integralFactor + derivFactor * derivFactor); | 324 | Vector3 ret = -( |
325 | error * proportionFactor | ||
326 | + RunningIntegration * integralFactor | ||
327 | + derivFactor * derivFactor | ||
328 | ); | ||
323 | 329 | ||
324 | return ret; | 330 | return ret; |
325 | } | 331 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 1fb4c31..5558ad5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -1,558 +1,559 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyrightD | 9 | * * Redistributions in binary form must reproduce the above copyrightD |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Text; | 29 | using System.Text; |
30 | 30 | ||
31 | using OpenSim.Region.Physics.Manager; | 31 | using OpenSim.Region.Physics.Manager; |
32 | 32 | ||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | 35 | ||
36 | namespace OpenSim.Region.Physics.BulletSPlugin | 36 | namespace OpenSim.Region.Physics.BulletSPlugin |
37 | { | 37 | { |
38 | public static class BSParam | 38 | public static class BSParam |
39 | { | 39 | { |
40 | // Level of Detail values kept as float because that's what the Meshmerizer wants | 40 | // Level of Detail values kept as float because that's what the Meshmerizer wants |
41 | public static float MeshLOD { get; private set; } | 41 | public static float MeshLOD { get; private set; } |
42 | public static float MeshMegaPrimLOD { get; private set; } | 42 | public static float MeshMegaPrimLOD { get; private set; } |
43 | public static float MeshMegaPrimThreshold { get; private set; } | 43 | public static float MeshMegaPrimThreshold { get; private set; } |
44 | public static float SculptLOD { get; private set; } | 44 | public static float SculptLOD { get; private set; } |
45 | 45 | ||
46 | public static float MinimumObjectMass { get; private set; } | 46 | public static float MinimumObjectMass { get; private set; } |
47 | public static float MaximumObjectMass { get; private set; } | 47 | public static float MaximumObjectMass { get; private set; } |
48 | 48 | ||
49 | public static float LinearDamping { get; private set; } | 49 | public static float LinearDamping { get; private set; } |
50 | public static float AngularDamping { get; private set; } | 50 | public static float AngularDamping { get; private set; } |
51 | public static float DeactivationTime { get; private set; } | 51 | public static float DeactivationTime { get; private set; } |
52 | public static float LinearSleepingThreshold { get; private set; } | 52 | public static float LinearSleepingThreshold { get; private set; } |
53 | public static float AngularSleepingThreshold { get; private set; } | 53 | public static float AngularSleepingThreshold { get; private set; } |
54 | public static float CcdMotionThreshold { get; private set; } | 54 | public static float CcdMotionThreshold { get; private set; } |
55 | public static float CcdSweptSphereRadius { get; private set; } | 55 | public static float CcdSweptSphereRadius { get; private set; } |
56 | public static float ContactProcessingThreshold { get; private set; } | 56 | public static float ContactProcessingThreshold { get; private set; } |
57 | 57 | ||
58 | public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed | 58 | public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed |
59 | public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes | 59 | public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes |
60 | public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects | 60 | public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects |
61 | 61 | ||
62 | public static float TerrainImplementation { get; private set; } | 62 | public static float TerrainImplementation { get; private set; } |
63 | public static float TerrainFriction { get; private set; } | 63 | public static float TerrainFriction { get; private set; } |
64 | public static float TerrainHitFraction { get; private set; } | 64 | public static float TerrainHitFraction { get; private set; } |
65 | public static float TerrainRestitution { get; private set; } | 65 | public static float TerrainRestitution { get; private set; } |
66 | public static float TerrainCollisionMargin { get; private set; } | 66 | public static float TerrainCollisionMargin { get; private set; } |
67 | 67 | ||
68 | // Avatar parameters | 68 | // Avatar parameters |
69 | public static float AvatarFriction { get; private set; } | 69 | public static float AvatarFriction { get; private set; } |
70 | public static float AvatarStandingFriction { get; private set; } | 70 | public static float AvatarStandingFriction { get; private set; } |
71 | public static float AvatarDensity { get; private set; } | 71 | public static float AvatarDensity { get; private set; } |
72 | public static float AvatarRestitution { get; private set; } | 72 | public static float AvatarRestitution { get; private set; } |
73 | public static float AvatarCapsuleWidth { get; private set; } | 73 | public static float AvatarCapsuleWidth { get; private set; } |
74 | public static float AvatarCapsuleDepth { get; private set; } | 74 | public static float AvatarCapsuleDepth { get; private set; } |
75 | public static float AvatarCapsuleHeight { get; private set; } | 75 | public static float AvatarCapsuleHeight { get; private set; } |
76 | public static float AvatarContactProcessingThreshold { get; private set; } | 76 | public static float AvatarContactProcessingThreshold { get; private set; } |
77 | 77 | ||
78 | public static float VehicleAngularDamping { get; private set; } | 78 | public static float VehicleAngularDamping { get; private set; } |
79 | 79 | ||
80 | public static float LinksetImplementation { get; private set; } | 80 | public static float LinksetImplementation { get; private set; } |
81 | public static float LinkConstraintUseFrameOffset { get; private set; } | 81 | public static float LinkConstraintUseFrameOffset { get; private set; } |
82 | public static float LinkConstraintEnableTransMotor { get; private set; } | 82 | public static float LinkConstraintEnableTransMotor { get; private set; } |
83 | public static float LinkConstraintTransMotorMaxVel { get; private set; } | 83 | public static float LinkConstraintTransMotorMaxVel { get; private set; } |
84 | public static float LinkConstraintTransMotorMaxForce { get; private set; } | 84 | public static float LinkConstraintTransMotorMaxForce { get; private set; } |
85 | public static float LinkConstraintERP { get; private set; } | 85 | public static float LinkConstraintERP { get; private set; } |
86 | public static float LinkConstraintCFM { get; private set; } | 86 | public static float LinkConstraintCFM { get; private set; } |
87 | public static float LinkConstraintSolverIterations { get; private set; } | 87 | public static float LinkConstraintSolverIterations { get; private set; } |
88 | 88 | ||
89 | public static float PID_D { get; private set; } // derivative | 89 | public static float PID_D { get; private set; } // derivative |
90 | public static float PID_P { get; private set; } // proportional | 90 | public static float PID_P { get; private set; } // proportional |
91 | 91 | ||
92 | public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); | 92 | public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); |
93 | public delegate float ParamGet(BSScene scene); | 93 | public delegate float ParamGet(BSScene scene); |
94 | public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val); | 94 | public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val); |
95 | public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); | 95 | public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); |
96 | 96 | ||
97 | public struct ParameterDefn | 97 | public struct ParameterDefn |
98 | { | 98 | { |
99 | public string name; // string name of the parameter | 99 | public string name; // string name of the parameter |
100 | public string desc; // a short description of what the parameter means | 100 | public string desc; // a short description of what the parameter means |
101 | public float defaultValue; // default value if not specified anywhere else | 101 | public float defaultValue; // default value if not specified anywhere else |
102 | public ParamUser userParam; // get the value from the configuration file | 102 | public ParamUser userParam; // get the value from the configuration file |
103 | public ParamGet getter; // return the current value stored for this parameter | 103 | public ParamGet getter; // return the current value stored for this parameter |
104 | public ParamSet setter; // set the current value for this parameter | 104 | public ParamSet setter; // set the current value for this parameter |
105 | public SetOnObject onObject; // set the value on an object in the physical domain | 105 | public SetOnObject onObject; // set the value on an object in the physical domain |
106 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) | 106 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) |
107 | { | 107 | { |
108 | name = n; | 108 | name = n; |
109 | desc = d; | 109 | desc = d; |
110 | defaultValue = v; | 110 | defaultValue = v; |
111 | userParam = u; | 111 | userParam = u; |
112 | getter = g; | 112 | getter = g; |
113 | setter = s; | 113 | setter = s; |
114 | onObject = null; | 114 | onObject = null; |
115 | } | 115 | } |
116 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) | 116 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) |
117 | { | 117 | { |
118 | name = n; | 118 | name = n; |
119 | desc = d; | 119 | desc = d; |
120 | defaultValue = v; | 120 | defaultValue = v; |
121 | userParam = u; | 121 | userParam = u; |
122 | getter = g; | 122 | getter = g; |
123 | setter = s; | 123 | setter = s; |
124 | onObject = o; | 124 | onObject = o; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | // List of all of the externally visible parameters. | 128 | // List of all of the externally visible parameters. |
129 | // For each parameter, this table maps a text name to getter and setters. | 129 | // For each parameter, this table maps a text name to getter and setters. |
130 | // To add a new externally referencable/settable parameter, add the paramter storage | 130 | // To add a new externally referencable/settable parameter, add the paramter storage |
131 | // location somewhere in the program and make an entry in this table with the | 131 | // location somewhere in the program and make an entry in this table with the |
132 | // getters and setters. | 132 | // getters and setters. |
133 | // It is easiest to find an existing definition and copy it. | 133 | // It is easiest to find an existing definition and copy it. |
134 | // Parameter values are floats. Booleans are converted to a floating value. | 134 | // Parameter values are floats. Booleans are converted to a floating value. |
135 | // | 135 | // |
136 | // A ParameterDefn() takes the following parameters: | 136 | // A ParameterDefn() takes the following parameters: |
137 | // -- the text name of the parameter. This is used for console input and ini file. | 137 | // -- the text name of the parameter. This is used for console input and ini file. |
138 | // -- a short text description of the parameter. This shows up in the console listing. | 138 | // -- a short text description of the parameter. This shows up in the console listing. |
139 | // -- a delegate for fetching the parameter from the ini file. | 139 | // -- a default value (float) |
140 | // Should handle fetching the right type from the ini file and converting it. | 140 | // -- a delegate for fetching the parameter from the ini file. |
141 | // -- a delegate for getting the value as a float | 141 | // Should handle fetching the right type from the ini file and converting it. |
142 | // -- a delegate for setting the value from a float | 142 | // -- a delegate for getting the value as a float |
143 | // -- an optional delegate to update the value in the world. Most often used to | 143 | // -- a delegate for setting the value from a float |
144 | // push the new value to an in-world object. | 144 | // -- an optional delegate to update the value in the world. Most often used to |
145 | // | 145 | // push the new value to an in-world object. |
146 | // The single letter parameters for the delegates are: | 146 | // |
147 | // s = BSScene | 147 | // The single letter parameters for the delegates are: |
148 | // o = BSPhysObject | 148 | // s = BSScene |
149 | // p = string parameter name | 149 | // o = BSPhysObject |
150 | // l = localID of referenced object | 150 | // p = string parameter name |
151 | // v = float value | 151 | // l = localID of referenced object |
152 | // cf = parameter configuration class (for fetching values from ini file) | 152 | // v = value (float) |
153 | private static ParameterDefn[] ParameterDefinitions = | 153 | // cf = parameter configuration class (for fetching values from ini file) |
154 | { | 154 | private static ParameterDefn[] ParameterDefinitions = |
155 | new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", | 155 | { |
156 | ConfigurationParameters.numericTrue, | 156 | new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", |
157 | (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 157 | ConfigurationParameters.numericTrue, |
158 | (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, | 158 | (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, |
159 | (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), | 159 | (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, |
160 | new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", | 160 | (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), |
161 | ConfigurationParameters.numericFalse, | 161 | new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", |
162 | (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 162 | ConfigurationParameters.numericFalse, |
163 | (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, | 163 | (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, |
164 | (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), | 164 | (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, |
165 | new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", | 165 | (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), |
166 | ConfigurationParameters.numericTrue, | 166 | new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", |
167 | (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 167 | ConfigurationParameters.numericTrue, |
168 | (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, | 168 | (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, |
169 | (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), | 169 | (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, |
170 | 170 | (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), | |
171 | new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", | 171 | |
172 | 8f, | 172 | new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", |
173 | (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, | 173 | 8f, |
174 | (s) => { return MeshLOD; }, | 174 | (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, |
175 | (s,p,l,v) => { MeshLOD = v; } ), | 175 | (s) => { return MeshLOD; }, |
176 | new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", | 176 | (s,p,l,v) => { MeshLOD = v; } ), |
177 | 16f, | 177 | new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", |
178 | (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, | 178 | 16f, |
179 | (s) => { return MeshMegaPrimLOD; }, | 179 | (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, |
180 | (s,p,l,v) => { MeshMegaPrimLOD = v; } ), | 180 | (s) => { return MeshMegaPrimLOD; }, |
181 | new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", | 181 | (s,p,l,v) => { MeshMegaPrimLOD = v; } ), |
182 | 10f, | 182 | new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", |
183 | (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, | 183 | 10f, |
184 | (s) => { return MeshMegaPrimThreshold; }, | 184 | (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, |
185 | (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), | 185 | (s) => { return MeshMegaPrimThreshold; }, |
186 | new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", | 186 | (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), |
187 | 32f, | 187 | new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", |
188 | (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, | 188 | 32f, |
189 | (s) => { return SculptLOD; }, | 189 | (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, |
190 | (s,p,l,v) => { SculptLOD = v; } ), | 190 | (s) => { return SculptLOD; }, |
191 | 191 | (s,p,l,v) => { SculptLOD = v; } ), | |
192 | new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", | 192 | |
193 | 10f, | 193 | new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", |
194 | (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, | 194 | 10f, |
195 | (s) => { return (float)s.m_maxSubSteps; }, | 195 | (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, |
196 | (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), | 196 | (s) => { return (float)s.m_maxSubSteps; }, |
197 | new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", | 197 | (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), |
198 | 1f / 60f, | 198 | new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", |
199 | (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, | 199 | 1f / 60f, |
200 | (s) => { return (float)s.m_fixedTimeStep; }, | 200 | (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, |
201 | (s,p,l,v) => { s.m_fixedTimeStep = v; } ), | 201 | (s) => { return (float)s.m_fixedTimeStep; }, |
202 | new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", | 202 | (s,p,l,v) => { s.m_fixedTimeStep = v; } ), |
203 | 2048f, | 203 | new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", |
204 | (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, | 204 | 2048f, |
205 | (s) => { return (float)s.m_maxCollisionsPerFrame; }, | 205 | (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, |
206 | (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), | 206 | (s) => { return (float)s.m_maxCollisionsPerFrame; }, |
207 | new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", | 207 | (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), |
208 | 8000f, | 208 | new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", |
209 | (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, | 209 | 8000f, |
210 | (s) => { return (float)s.m_maxUpdatesPerFrame; }, | 210 | (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, |
211 | (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), | 211 | (s) => { return (float)s.m_maxUpdatesPerFrame; }, |
212 | new ParameterDefn("MaxTaintsToProcessPerStep", "Number of update taints to process before each simulation step", | 212 | (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), |
213 | 500f, | 213 | new ParameterDefn("MaxTaintsToProcessPerStep", "Number of update taints to process before each simulation step", |
214 | (s,cf,p,v) => { s.m_taintsToProcessPerStep = cf.GetInt(p, (int)v); }, | 214 | 500f, |
215 | (s) => { return (float)s.m_taintsToProcessPerStep; }, | 215 | (s,cf,p,v) => { s.m_taintsToProcessPerStep = cf.GetInt(p, (int)v); }, |
216 | (s,p,l,v) => { s.m_taintsToProcessPerStep = (int)v; } ), | 216 | (s) => { return (float)s.m_taintsToProcessPerStep; }, |
217 | new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", | 217 | (s,p,l,v) => { s.m_taintsToProcessPerStep = (int)v; } ), |
218 | 0.0001f, | 218 | new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", |
219 | (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, | 219 | 0.0001f, |
220 | (s) => { return (float)MinimumObjectMass; }, | 220 | (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, |
221 | (s,p,l,v) => { MinimumObjectMass = v; } ), | 221 | (s) => { return (float)MinimumObjectMass; }, |
222 | new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", | 222 | (s,p,l,v) => { MinimumObjectMass = v; } ), |
223 | 10000.01f, | 223 | new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", |
224 | (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, | 224 | 10000.01f, |
225 | (s) => { return (float)MaximumObjectMass; }, | 225 | (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, |
226 | (s,p,l,v) => { MaximumObjectMass = v; } ), | 226 | (s) => { return (float)MaximumObjectMass; }, |
227 | 227 | (s,p,l,v) => { MaximumObjectMass = v; } ), | |
228 | new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", | 228 | |
229 | 2200f, | 229 | new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", |
230 | (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, | 230 | 2200f, |
231 | (s) => { return (float)PID_D; }, | 231 | (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, |
232 | (s,p,l,v) => { PID_D = v; } ), | 232 | (s) => { return (float)PID_D; }, |
233 | new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", | 233 | (s,p,l,v) => { PID_D = v; } ), |
234 | 900f, | 234 | new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", |
235 | (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, | 235 | 900f, |
236 | (s) => { return (float)PID_P; }, | 236 | (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, |
237 | (s,p,l,v) => { PID_P = v; } ), | 237 | (s) => { return (float)PID_P; }, |
238 | 238 | (s,p,l,v) => { PID_P = v; } ), | |
239 | new ParameterDefn("DefaultFriction", "Friction factor used on new objects", | 239 | |
240 | 0.2f, | 240 | new ParameterDefn("DefaultFriction", "Friction factor used on new objects", |
241 | (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, | 241 | 0.2f, |
242 | (s) => { return s.UnmanagedParams[0].defaultFriction; }, | 242 | (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, |
243 | (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), | 243 | (s) => { return s.UnmanagedParams[0].defaultFriction; }, |
244 | new ParameterDefn("DefaultDensity", "Density for new objects" , | 244 | (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), |
245 | 10.000006836f, // Aluminum g/cm3 | 245 | new ParameterDefn("DefaultDensity", "Density for new objects" , |
246 | (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, | 246 | 10.000006836f, // Aluminum g/cm3 |
247 | (s) => { return s.UnmanagedParams[0].defaultDensity; }, | 247 | (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, |
248 | (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), | 248 | (s) => { return s.UnmanagedParams[0].defaultDensity; }, |
249 | new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , | 249 | (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), |
250 | 0f, | 250 | new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , |
251 | (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, | 251 | 0f, |
252 | (s) => { return s.UnmanagedParams[0].defaultRestitution; }, | 252 | (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, |
253 | (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), | 253 | (s) => { return s.UnmanagedParams[0].defaultRestitution; }, |
254 | new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", | 254 | (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), |
255 | 0.04f, | 255 | new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", |
256 | (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, | 256 | 0.04f, |
257 | (s) => { return s.UnmanagedParams[0].collisionMargin; }, | 257 | (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, |
258 | (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), | 258 | (s) => { return s.UnmanagedParams[0].collisionMargin; }, |
259 | new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", | 259 | (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), |
260 | -9.80665f, | 260 | new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", |
261 | (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, | 261 | -9.80665f, |
262 | (s) => { return s.UnmanagedParams[0].gravity; }, | 262 | (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, |
263 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, | 263 | (s) => { return s.UnmanagedParams[0].gravity; }, |
264 | (s,o,v) => { BulletSimAPI.SetGravity2(s.World.ptr, new Vector3(0f,0f,v)); } ), | 264 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, |
265 | 265 | (s,o,v) => { BulletSimAPI.SetGravity2(s.World.ptr, new Vector3(0f,0f,v)); } ), | |
266 | 266 | ||
267 | new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", | 267 | |
268 | 0f, | 268 | new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", |
269 | (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, | 269 | 0f, |
270 | (s) => { return LinearDamping; }, | 270 | (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, |
271 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, | 271 | (s) => { return LinearDamping; }, |
272 | (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, AngularDamping); } ), | 272 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, |
273 | new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", | 273 | (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, AngularDamping); } ), |
274 | 0f, | 274 | new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", |
275 | (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, | 275 | 0f, |
276 | (s) => { return AngularDamping; }, | 276 | (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, |
277 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, | 277 | (s) => { return AngularDamping; }, |
278 | (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, LinearDamping, v); } ), | 278 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, |
279 | new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", | 279 | (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, LinearDamping, v); } ), |
280 | 0.2f, | 280 | new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", |
281 | (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, | 281 | 0.2f, |
282 | (s) => { return DeactivationTime; }, | 282 | (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, |
283 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, | 283 | (s) => { return DeactivationTime; }, |
284 | (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ), | 284 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, |
285 | new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", | 285 | (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ), |
286 | 0.8f, | 286 | new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", |
287 | (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, | 287 | 0.8f, |
288 | (s) => { return LinearSleepingThreshold; }, | 288 | (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, |
289 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, | 289 | (s) => { return LinearSleepingThreshold; }, |
290 | (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), | 290 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, |
291 | new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", | 291 | (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), |
292 | 1.0f, | 292 | new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", |
293 | (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, | 293 | 1.0f, |
294 | (s) => { return AngularSleepingThreshold; }, | 294 | (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, |
295 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, | 295 | (s) => { return AngularSleepingThreshold; }, |
296 | (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), | 296 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, |
297 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , | 297 | (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ), |
298 | 0f, // set to zero to disable | 298 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , |
299 | (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, | 299 | 0f, // set to zero to disable |
300 | (s) => { return CcdMotionThreshold; }, | 300 | (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, |
301 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, | 301 | (s) => { return CcdMotionThreshold; }, |
302 | (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ), | 302 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, |
303 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , | 303 | (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ), |
304 | 0f, | 304 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , |
305 | (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, | 305 | 0f, |
306 | (s) => { return CcdSweptSphereRadius; }, | 306 | (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, |
307 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, | 307 | (s) => { return CcdSweptSphereRadius; }, |
308 | (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ), | 308 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, |
309 | new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , | 309 | (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ), |
310 | 0.1f, | 310 | new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , |
311 | (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, | 311 | 0.1f, |
312 | (s) => { return ContactProcessingThreshold; }, | 312 | (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, |
313 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, | 313 | (s) => { return ContactProcessingThreshold; }, |
314 | (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), | 314 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, |
315 | 315 | (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), | |
316 | new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", | 316 | |
317 | (float)BSTerrainPhys.TerrainImplementation.Mesh, | 317 | new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", |
318 | (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, | 318 | (float)BSTerrainPhys.TerrainImplementation.Mesh, |
319 | (s) => { return TerrainImplementation; }, | 319 | (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, |
320 | (s,p,l,v) => { TerrainImplementation = v; } ), | 320 | (s) => { return TerrainImplementation; }, |
321 | new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , | 321 | (s,p,l,v) => { TerrainImplementation = v; } ), |
322 | 0.3f, | 322 | new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , |
323 | (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, | 323 | 0.3f, |
324 | (s) => { return TerrainFriction; }, | 324 | (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, |
325 | (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), | 325 | (s) => { return TerrainFriction; }, |
326 | new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , | 326 | (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), |
327 | 0.8f, | 327 | new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , |
328 | (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, | 328 | 0.8f, |
329 | (s) => { return TerrainHitFraction; }, | 329 | (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, |
330 | (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), | 330 | (s) => { return TerrainHitFraction; }, |
331 | new ParameterDefn("TerrainRestitution", "Bouncyness" , | 331 | (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), |
332 | 0f, | 332 | new ParameterDefn("TerrainRestitution", "Bouncyness" , |
333 | (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, | 333 | 0f, |
334 | (s) => { return TerrainRestitution; }, | 334 | (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, |
335 | (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), | 335 | (s) => { return TerrainRestitution; }, |
336 | new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , | 336 | (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), |
337 | 0.04f, | 337 | new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , |
338 | (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, | 338 | 0.04f, |
339 | (s) => { return TerrainCollisionMargin; }, | 339 | (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, |
340 | (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), | 340 | (s) => { return TerrainCollisionMargin; }, |
341 | 341 | (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), | |
342 | new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", | 342 | |
343 | 0.2f, | 343 | new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", |
344 | (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, | 344 | 0.2f, |
345 | (s) => { return AvatarFriction; }, | 345 | (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, |
346 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), | 346 | (s) => { return AvatarFriction; }, |
347 | new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", | 347 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), |
348 | 10.0f, | 348 | new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", |
349 | (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, | 349 | 10.0f, |
350 | (s) => { return AvatarStandingFriction; }, | 350 | (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, |
351 | (s,p,l,v) => { AvatarStandingFriction = v; } ), | 351 | (s) => { return AvatarStandingFriction; }, |
352 | new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", | 352 | (s,p,l,v) => { AvatarStandingFriction = v; } ), |
353 | 60f, | 353 | new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", |
354 | (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, | 354 | 60f, |
355 | (s) => { return AvatarDensity; }, | 355 | (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, |
356 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), | 356 | (s) => { return AvatarDensity; }, |
357 | new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 357 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), |
358 | 0f, | 358 | new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
359 | (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, | 359 | 0f, |
360 | (s) => { return AvatarRestitution; }, | 360 | (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, |
361 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), | 361 | (s) => { return AvatarRestitution; }, |
362 | new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", | 362 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), |
363 | 0.6f, | 363 | new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", |
364 | (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, | 364 | 0.6f, |
365 | (s) => { return AvatarCapsuleWidth; }, | 365 | (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, |
366 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), | 366 | (s) => { return AvatarCapsuleWidth; }, |
367 | new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", | 367 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), |
368 | 0.45f, | 368 | new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", |
369 | (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, | 369 | 0.45f, |
370 | (s) => { return AvatarCapsuleDepth; }, | 370 | (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, |
371 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), | 371 | (s) => { return AvatarCapsuleDepth; }, |
372 | new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", | 372 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), |
373 | 1.5f, | 373 | new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", |
374 | (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, | 374 | 1.5f, |
375 | (s) => { return AvatarCapsuleHeight; }, | 375 | (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, |
376 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), | 376 | (s) => { return AvatarCapsuleHeight; }, |
377 | new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 377 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), |
378 | 0.1f, | 378 | new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
379 | (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, | 379 | 0.1f, |
380 | (s) => { return AvatarContactProcessingThreshold; }, | 380 | (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, |
381 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), | 381 | (s) => { return AvatarContactProcessingThreshold; }, |
382 | 382 | (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), | |
383 | new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", | 383 | |
384 | 0.95f, | 384 | new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", |
385 | (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, | 385 | 0.95f, |
386 | (s) => { return VehicleAngularDamping; }, | 386 | (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, |
387 | (s,p,l,v) => { VehicleAngularDamping = v; } ), | 387 | (s) => { return VehicleAngularDamping; }, |
388 | 388 | (s,p,l,v) => { VehicleAngularDamping = v; } ), | |
389 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", | 389 | |
390 | 0f, | 390 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", |
391 | (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, | 391 | 0f, |
392 | (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, | 392 | (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, |
393 | (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), | 393 | (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, |
394 | new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", | 394 | (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), |
395 | 0f, | 395 | new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", |
396 | (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, | 396 | 0f, |
397 | (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, | 397 | (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, |
398 | (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), | 398 | (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, |
399 | new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", | 399 | (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), |
400 | ConfigurationParameters.numericFalse, | 400 | new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", |
401 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 401 | ConfigurationParameters.numericFalse, |
402 | (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, | 402 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
403 | (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), | 403 | (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, |
404 | new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", | 404 | (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), |
405 | ConfigurationParameters.numericFalse, | 405 | new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", |
406 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 406 | ConfigurationParameters.numericFalse, |
407 | (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, | 407 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
408 | (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), | 408 | (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, |
409 | new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", | 409 | (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), |
410 | ConfigurationParameters.numericTrue, | 410 | new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", |
411 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 411 | ConfigurationParameters.numericTrue, |
412 | (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, | 412 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
413 | (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), | 413 | (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, |
414 | new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", | 414 | (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), |
415 | ConfigurationParameters.numericTrue, | 415 | new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", |
416 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 416 | ConfigurationParameters.numericTrue, |
417 | (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, | 417 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
418 | (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), | 418 | (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, |
419 | new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", | 419 | (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), |
420 | ConfigurationParameters.numericFalse, | 420 | new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", |
421 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 421 | ConfigurationParameters.numericFalse, |
422 | (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, | 422 | (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
423 | (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), | 423 | (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, |
424 | new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", | 424 | (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), |
425 | 0f, // zero says use Bullet default | 425 | new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", |
426 | (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, | 426 | 0f, // zero says use Bullet default |
427 | (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, | 427 | (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, |
428 | (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), | 428 | (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, |
429 | 429 | (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), | |
430 | new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", | 430 | |
431 | (float)BSLinkset.LinksetImplementation.Compound, | 431 | new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", |
432 | (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, | 432 | (float)BSLinkset.LinksetImplementation.Compound, |
433 | (s) => { return LinksetImplementation; }, | 433 | (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, |
434 | (s,p,l,v) => { LinksetImplementation = v; } ), | 434 | (s) => { return LinksetImplementation; }, |
435 | new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", | 435 | (s,p,l,v) => { LinksetImplementation = v; } ), |
436 | ConfigurationParameters.numericFalse, | 436 | new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", |
437 | (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 437 | ConfigurationParameters.numericFalse, |
438 | (s) => { return LinkConstraintUseFrameOffset; }, | 438 | (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
439 | (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), | 439 | (s) => { return LinkConstraintUseFrameOffset; }, |
440 | new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", | 440 | (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), |
441 | ConfigurationParameters.numericTrue, | 441 | new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", |
442 | (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 442 | ConfigurationParameters.numericTrue, |
443 | (s) => { return LinkConstraintEnableTransMotor; }, | 443 | (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, |
444 | (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), | 444 | (s) => { return LinkConstraintEnableTransMotor; }, |
445 | new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", | 445 | (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), |
446 | 5.0f, | 446 | new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", |
447 | (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, | 447 | 5.0f, |
448 | (s) => { return LinkConstraintTransMotorMaxVel; }, | 448 | (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, |
449 | (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), | 449 | (s) => { return LinkConstraintTransMotorMaxVel; }, |
450 | new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", | 450 | (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), |
451 | 0.1f, | 451 | new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", |
452 | (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, | 452 | 0.1f, |
453 | (s) => { return LinkConstraintTransMotorMaxForce; }, | 453 | (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, |
454 | (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), | 454 | (s) => { return LinkConstraintTransMotorMaxForce; }, |
455 | new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", | 455 | (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), |
456 | 0.1f, | 456 | new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", |
457 | (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, | 457 | 0.1f, |
458 | (s) => { return LinkConstraintCFM; }, | 458 | (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, |
459 | (s,p,l,v) => { LinkConstraintCFM = v; } ), | 459 | (s) => { return LinkConstraintCFM; }, |
460 | new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", | 460 | (s,p,l,v) => { LinkConstraintCFM = v; } ), |
461 | 0.1f, | 461 | new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", |
462 | (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, | 462 | 0.1f, |
463 | (s) => { return LinkConstraintERP; }, | 463 | (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, |
464 | (s,p,l,v) => { LinkConstraintERP = v; } ), | 464 | (s) => { return LinkConstraintERP; }, |
465 | new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", | 465 | (s,p,l,v) => { LinkConstraintERP = v; } ), |
466 | 40, | 466 | new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", |
467 | (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, | 467 | 40, |
468 | (s) => { return LinkConstraintSolverIterations; }, | 468 | (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, |
469 | (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), | 469 | (s) => { return LinkConstraintSolverIterations; }, |
470 | 470 | (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), | |
471 | new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)", | 471 | |
472 | 0f, | 472 | new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)", |
473 | (s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); }, | 473 | 0f, |
474 | (s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; }, | 474 | (s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); }, |
475 | (s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ), | 475 | (s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; }, |
476 | }; | 476 | (s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ), |
477 | 477 | }; | |
478 | // Convert a boolean to our numeric true and false values | 478 | |
479 | public static float NumericBool(bool b) | 479 | // Convert a boolean to our numeric true and false values |
480 | { | 480 | public static float NumericBool(bool b) |
481 | return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse); | 481 | { |
482 | } | 482 | return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse); |
483 | 483 | } | |
484 | // Convert numeric true and false values to a boolean | 484 | |
485 | public static bool BoolNumeric(float b) | 485 | // Convert numeric true and false values to a boolean |
486 | { | 486 | public static bool BoolNumeric(float b) |
487 | return (b == ConfigurationParameters.numericTrue ? true : false); | 487 | { |
488 | } | 488 | return (b == ConfigurationParameters.numericTrue ? true : false); |
489 | 489 | } | |
490 | // Search through the parameter definitions and return the matching | 490 | |
491 | // ParameterDefn structure. | 491 | // Search through the parameter definitions and return the matching |
492 | // Case does not matter as names are compared after converting to lower case. | 492 | // ParameterDefn structure. |
493 | // Returns 'false' if the parameter is not found. | 493 | // Case does not matter as names are compared after converting to lower case. |
494 | internal static bool TryGetParameter(string paramName, out ParameterDefn defn) | 494 | // Returns 'false' if the parameter is not found. |
495 | { | 495 | internal static bool TryGetParameter(string paramName, out ParameterDefn defn) |
496 | bool ret = false; | 496 | { |
497 | ParameterDefn foundDefn = new ParameterDefn(); | 497 | bool ret = false; |
498 | string pName = paramName.ToLower(); | 498 | ParameterDefn foundDefn = new ParameterDefn(); |
499 | 499 | string pName = paramName.ToLower(); | |
500 | foreach (ParameterDefn parm in ParameterDefinitions) | 500 | |
501 | { | 501 | foreach (ParameterDefn parm in ParameterDefinitions) |
502 | if (pName == parm.name.ToLower()) | 502 | { |
503 | { | 503 | if (pName == parm.name.ToLower()) |
504 | foundDefn = parm; | 504 | { |
505 | ret = true; | 505 | foundDefn = parm; |
506 | break; | 506 | ret = true; |
507 | } | 507 | break; |
508 | } | 508 | } |
509 | defn = foundDefn; | 509 | } |
510 | return ret; | 510 | defn = foundDefn; |
511 | } | 511 | return ret; |
512 | 512 | } | |
513 | // Pass through the settable parameters and set the default values | 513 | |
514 | internal static void SetParameterDefaultValues(BSScene physicsScene) | 514 | // Pass through the settable parameters and set the default values |
515 | { | 515 | internal static void SetParameterDefaultValues(BSScene physicsScene) |
516 | foreach (ParameterDefn parm in ParameterDefinitions) | 516 | { |
517 | { | 517 | foreach (ParameterDefn parm in ParameterDefinitions) |
518 | parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); | 518 | { |
519 | } | 519 | parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); |
520 | } | 520 | } |
521 | 521 | } | |
522 | // Get user set values out of the ini file. | 522 | |
523 | internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) | 523 | // Get user set values out of the ini file. |
524 | { | 524 | internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) |
525 | foreach (ParameterDefn parm in ParameterDefinitions) | 525 | { |
526 | { | 526 | foreach (ParameterDefn parm in ParameterDefinitions) |
527 | parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); | 527 | { |
528 | } | 528 | parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); |
529 | } | 529 | } |
530 | 530 | } | |
531 | internal static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[1]; | 531 | |
532 | 532 | internal static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[1]; | |
533 | // This creates an array in the correct format for returning the list of | 533 | |
534 | // parameters. This is used by the 'list' option of the 'physics' command. | 534 | // This creates an array in the correct format for returning the list of |
535 | internal static void BuildParameterTable() | 535 | // parameters. This is used by the 'list' option of the 'physics' command. |
536 | { | 536 | internal static void BuildParameterTable() |
537 | if (SettableParameters.Length < ParameterDefinitions.Length) | 537 | { |
538 | { | 538 | if (SettableParameters.Length < ParameterDefinitions.Length) |
539 | List<PhysParameterEntry> entries = new List<PhysParameterEntry>(); | 539 | { |
540 | for (int ii = 0; ii < ParameterDefinitions.Length; ii++) | 540 | List<PhysParameterEntry> entries = new List<PhysParameterEntry>(); |
541 | { | 541 | for (int ii = 0; ii < ParameterDefinitions.Length; ii++) |
542 | ParameterDefn pd = ParameterDefinitions[ii]; | 542 | { |
543 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); | 543 | ParameterDefn pd = ParameterDefinitions[ii]; |
544 | } | 544 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); |
545 | 545 | } | |
546 | // make the list in alphabetical order for estetic reasons | 546 | |
547 | entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) | 547 | // make the list in alphabetical order for estetic reasons |
548 | { | 548 | entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) |
549 | return ppe1.name.CompareTo(ppe2.name); | 549 | { |
550 | }); | 550 | return ppe1.name.CompareTo(ppe2.name); |
551 | 551 | }); | |
552 | SettableParameters = entries.ToArray(); | 552 | |
553 | } | 553 | SettableParameters = entries.ToArray(); |
554 | } | 554 | } |
555 | 555 | } | |
556 | 556 | ||
557 | } | 557 | |
558 | } | 558 | } |
559 | } | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 492a255..eb47178 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -864,7 +864,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
864 | { | 864 | { |
865 | DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); | 865 | DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); |
866 | m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); | 866 | m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); |
867 | Util.PrintCallStack(DetailLog); // Prints the stack into the DEBUG log file. | 867 | Util.PrintCallStack(DetailLog); |
868 | } | 868 | } |
869 | return InTaintTime; | 869 | return InTaintTime; |
870 | } | 870 | } |