diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 104 |
1 files changed, 94 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 834228e..6d46fe6 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -54,6 +54,14 @@ public static class BSParam | |||
54 | // =================== | 54 | // =================== |
55 | // From: | 55 | // From: |
56 | 56 | ||
57 | /// <summary> | ||
58 | /// Set whether physics is active or not. | ||
59 | /// </summary> | ||
60 | /// <remarks> | ||
61 | /// Can be enabled and disabled to start and stop physics. | ||
62 | /// </remarks> | ||
63 | public static bool Active { get; private set; } | ||
64 | |||
57 | public static bool UseSeparatePhysicsThread { get; private set; } | 65 | public static bool UseSeparatePhysicsThread { get; private set; } |
58 | public static float PhysicsTimeStep { get; private set; } | 66 | public static float PhysicsTimeStep { get; private set; } |
59 | 67 | ||
@@ -97,6 +105,7 @@ public static class BSParam | |||
97 | 105 | ||
98 | public static float TerrainImplementation { get; set; } | 106 | public static float TerrainImplementation { get; set; } |
99 | public static int TerrainMeshMagnification { get; private set; } | 107 | public static int TerrainMeshMagnification { get; private set; } |
108 | public static float TerrainGroundPlane { get; private set; } | ||
100 | public static float TerrainFriction { get; private set; } | 109 | public static float TerrainFriction { get; private set; } |
101 | public static float TerrainHitFraction { get; private set; } | 110 | public static float TerrainHitFraction { get; private set; } |
102 | public static float TerrainRestitution { get; private set; } | 111 | public static float TerrainRestitution { get; private set; } |
@@ -123,22 +132,29 @@ public static class BSParam | |||
123 | public static float PhysicsUnmanLoggingFrames { get; private set; } | 132 | public static float PhysicsUnmanLoggingFrames { get; private set; } |
124 | 133 | ||
125 | // Avatar parameters | 134 | // Avatar parameters |
135 | public static bool AvatarToAvatarCollisionsByDefault { get; private set; } | ||
126 | public static float AvatarFriction { get; private set; } | 136 | public static float AvatarFriction { get; private set; } |
127 | public static float AvatarStandingFriction { get; private set; } | 137 | public static float AvatarStandingFriction { get; private set; } |
128 | public static float AvatarAlwaysRunFactor { get; private set; } | 138 | public static float AvatarAlwaysRunFactor { get; private set; } |
129 | public static float AvatarDensity { get; private set; } | 139 | public static float AvatarDensity { get; private set; } |
130 | public static float AvatarRestitution { get; private set; } | 140 | public static float AvatarRestitution { get; private set; } |
141 | public static int AvatarShape { get; private set; } | ||
131 | public static float AvatarCapsuleWidth { get; private set; } | 142 | public static float AvatarCapsuleWidth { get; private set; } |
132 | public static float AvatarCapsuleDepth { get; private set; } | 143 | public static float AvatarCapsuleDepth { get; private set; } |
133 | public static float AvatarCapsuleHeight { get; private set; } | 144 | public static float AvatarCapsuleHeight { get; private set; } |
134 | public static float AvatarHeightLowFudge { get; private set; } | 145 | public static float AvatarHeightLowFudge { get; private set; } |
135 | public static float AvatarHeightMidFudge { get; private set; } | 146 | public static float AvatarHeightMidFudge { get; private set; } |
136 | public static float AvatarHeightHighFudge { get; private set; } | 147 | public static float AvatarHeightHighFudge { get; private set; } |
148 | public static float AvatarFlyingGroundMargin { get; private set; } | ||
149 | public static float AvatarFlyingGroundUpForce { get; private set; } | ||
150 | public static float AvatarTerminalVelocity { get; private set; } | ||
137 | public static float AvatarContactProcessingThreshold { get; private set; } | 151 | public static float AvatarContactProcessingThreshold { get; private set; } |
138 | public static float AvatarStopZeroThreshold { get; private set; } | 152 | public static float AvatarStopZeroThreshold { get; private set; } |
139 | public static int AvatarJumpFrames { get; private set; } | 153 | public static int AvatarJumpFrames { get; private set; } |
140 | public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } | 154 | public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } |
141 | public static float AvatarStepHeight { get; private set; } | 155 | public static float AvatarStepHeight { get; private set; } |
156 | public static float AvatarStepAngle { get; private set; } | ||
157 | public static float AvatarStepGroundFudge { get; private set; } | ||
142 | public static float AvatarStepApproachFactor { get; private set; } | 158 | public static float AvatarStepApproachFactor { get; private set; } |
143 | public static float AvatarStepForceFactor { get; private set; } | 159 | public static float AvatarStepForceFactor { get; private set; } |
144 | public static float AvatarStepUpCorrectionFactor { get; private set; } | 160 | public static float AvatarStepUpCorrectionFactor { get; private set; } |
@@ -147,6 +163,8 @@ public static class BSParam | |||
147 | // Vehicle parameters | 163 | // Vehicle parameters |
148 | public static float VehicleMaxLinearVelocity { get; private set; } | 164 | public static float VehicleMaxLinearVelocity { get; private set; } |
149 | public static float VehicleMaxLinearVelocitySquared { get; private set; } | 165 | public static float VehicleMaxLinearVelocitySquared { get; private set; } |
166 | public static float VehicleMinLinearVelocity { get; private set; } | ||
167 | public static float VehicleMinLinearVelocitySquared { get; private set; } | ||
150 | public static float VehicleMaxAngularVelocity { get; private set; } | 168 | public static float VehicleMaxAngularVelocity { get; private set; } |
151 | public static float VehicleMaxAngularVelocitySq { get; private set; } | 169 | public static float VehicleMaxAngularVelocitySq { get; private set; } |
152 | public static float VehicleAngularDamping { get; private set; } | 170 | public static float VehicleAngularDamping { get; private set; } |
@@ -165,6 +183,7 @@ public static class BSParam | |||
165 | public static bool VehicleEnableAngularBanking { get; private set; } | 183 | public static bool VehicleEnableAngularBanking { get; private set; } |
166 | 184 | ||
167 | // Convex Hulls | 185 | // Convex Hulls |
186 | // Parameters for convex hull routine that ships with Bullet | ||
168 | public static int CSHullMaxDepthSplit { get; private set; } | 187 | public static int CSHullMaxDepthSplit { get; private set; } |
169 | public static int CSHullMaxDepthSplitForSimpleShapes { get; private set; } | 188 | public static int CSHullMaxDepthSplitForSimpleShapes { get; private set; } |
170 | public static float CSHullConcavityThresholdPercent { get; private set; } | 189 | public static float CSHullConcavityThresholdPercent { get; private set; } |
@@ -180,6 +199,22 @@ public static class BSParam | |||
180 | public static bool BHullAddNeighboursDistPoints { get; private set; } // false | 199 | public static bool BHullAddNeighboursDistPoints { get; private set; } // false |
181 | public static bool BHullAddFacesPoints { get; private set; } // false | 200 | public static bool BHullAddFacesPoints { get; private set; } // false |
182 | public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false | 201 | public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false |
202 | public static float WhichHACD { get; private set; } // zero if Bullet HACD, non-zero says VHACD | ||
203 | // Parameters for VHACD 2.0: http://code.google.com/p/v-hacd | ||
204 | // To enable, set both ShouldUseBulletHACD=true and WhichHACD=1 | ||
205 | // http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html | ||
206 | public static float VHACDresolution { get; private set; } // 100,000 max number of voxels generated during voxelization stage | ||
207 | public static float VHACDdepth { get; private set; } // 20 max number of clipping stages | ||
208 | public static float VHACDconcavity { get; private set; } // 0.0025 maximum concavity | ||
209 | public static float VHACDplaneDownsampling { get; private set; } // 4 granularity of search for best clipping plane | ||
210 | public static float VHACDconvexHullDownsampling { get; private set; } // 4 precision of hull gen process | ||
211 | public static float VHACDalpha { get; private set; } // 0.05 bias toward clipping along symmetry planes | ||
212 | public static float VHACDbeta { get; private set; } // 0.05 bias toward clipping along revolution axis | ||
213 | public static float VHACDgamma { get; private set; } // 0.00125 max concavity when merging | ||
214 | public static float VHACDpca { get; private set; } // 0 on/off normalizing mesh before decomp | ||
215 | public static float VHACDmode { get; private set; } // 0 0:voxel based, 1: tetrahedron based | ||
216 | public static float VHACDmaxNumVerticesPerCH { get; private set; } // 64 max triangles per convex hull | ||
217 | public static float VHACDminVolumePerCH { get; private set; } // 0.0001 sampling of generated convex hulls | ||
183 | 218 | ||
184 | // Linkset implementation parameters | 219 | // Linkset implementation parameters |
185 | public static float LinksetImplementation { get; private set; } | 220 | public static float LinksetImplementation { get; private set; } |
@@ -366,6 +401,8 @@ public static class BSParam | |||
366 | // v = value (appropriate type) | 401 | // v = value (appropriate type) |
367 | private static ParameterDefnBase[] ParameterDefinitions = | 402 | private static ParameterDefnBase[] ParameterDefinitions = |
368 | { | 403 | { |
404 | new ParameterDefn<bool>("Active", "If 'true', false then physics is not active", | ||
405 | false ), | ||
369 | new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", | 406 | new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", |
370 | false ), | 407 | false ), |
371 | new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", | 408 | new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", |
@@ -538,9 +575,11 @@ public static class BSParam | |||
538 | (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), | 575 | (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), |
539 | 576 | ||
540 | new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", | 577 | new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", |
541 | (float)BSTerrainPhys.TerrainImplementation.Mesh ), | 578 | (float)BSTerrainPhys.TerrainImplementation.Heightmap ), |
542 | new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , | 579 | new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , |
543 | 2 ), | 580 | 2 ), |
581 | new ParameterDefn<float>("TerrainGroundPlane", "Altitude of ground plane used to keep things from falling to infinity" , | ||
582 | -500.0f ), | ||
544 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , | 583 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , |
545 | 0.3f ), | 584 | 0.3f ), |
546 | new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" , | 585 | new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" , |
@@ -550,8 +589,10 @@ public static class BSParam | |||
550 | new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , | 589 | new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , |
551 | 0.0f ), | 590 | 0.0f ), |
552 | new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , | 591 | new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , |
553 | 0.08f ), | 592 | 0.04f ), |
554 | 593 | ||
594 | new ParameterDefn<bool>("AvatarToAvatarCollisionsByDefault", "Should avatars collide with other avatars by default?", | ||
595 | true), | ||
555 | new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", | 596 | new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", |
556 | 0.2f ), | 597 | 0.2f ), |
557 | new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", | 598 | new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", |
@@ -563,6 +604,8 @@ public static class BSParam | |||
563 | 3500f) , // 3.5 * 100 | 604 | 3500f) , // 3.5 * 100 |
564 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 605 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
565 | 0f ), | 606 | 0f ), |
607 | new ParameterDefn<int>("AvatarShape", "Code for avatar physical shape: 0:capsule, 1:cube, 2:ovoid, 2:mesh", | ||
608 | BSShapeCollection.AvatarShapeCube ) , | ||
566 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", | 609 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", |
567 | 0.6f ) , | 610 | 0.6f ) , |
568 | new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", | 611 | new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", |
@@ -570,11 +613,17 @@ public static class BSParam | |||
570 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", | 613 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", |
571 | 1.5f ), | 614 | 1.5f ), |
572 | new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", | 615 | new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", |
573 | -0.2f ), | 616 | 0f ), |
574 | new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", | 617 | new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", |
575 | 0.1f ), | 618 | 0f ), |
576 | new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", | 619 | new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", |
577 | 0.1f ), | 620 | 0f ), |
621 | new ParameterDefn<float>("AvatarFlyingGroundMargin", "Meters avatar is kept above the ground when flying", | ||
622 | 5f ), | ||
623 | new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin", | ||
624 | 2.0f ), | ||
625 | new ParameterDefn<float>("AvatarTerminalVelocity", "Terminal Velocity of falling avatar", | ||
626 | -54.0f ), | ||
578 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 627 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
579 | 0.1f ), | 628 | 0.1f ), |
580 | new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", | 629 | new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", |
@@ -584,20 +633,28 @@ public static class BSParam | |||
584 | new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", | 633 | new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", |
585 | 4 ), | 634 | 4 ), |
586 | new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", | 635 | new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", |
587 | 0.6f ) , | 636 | 0.999f ) , |
637 | new ParameterDefn<float>("AvatarStepAngle", "The angle (in radians) for a vertical surface to be considered a step", | ||
638 | 0.3f ) , | ||
639 | new ParameterDefn<float>("AvatarStepGroundFudge", "Fudge factor subtracted from avatar base when comparing collision height", | ||
640 | 0.1f ) , | ||
588 | new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", | 641 | new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", |
589 | 0.6f ), | 642 | 2f ), |
590 | new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", | 643 | new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", |
591 | 1.0f ), | 644 | 0f ), |
592 | new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", | 645 | new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", |
593 | 1.0f ), | 646 | 0.8f ), |
594 | new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", | 647 | new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", |
595 | 2 ), | 648 | 1 ), |
596 | 649 | ||
597 | new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", | 650 | new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", |
598 | 1000.0f, | 651 | 1000.0f, |
599 | (s) => { return (float)VehicleMaxLinearVelocity; }, | 652 | (s) => { return (float)VehicleMaxLinearVelocity; }, |
600 | (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ), | 653 | (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ), |
654 | new ParameterDefn<float>("VehicleMinLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", | ||
655 | 0.001f, | ||
656 | (s) => { return (float)VehicleMinLinearVelocity; }, | ||
657 | (s,v) => { VehicleMinLinearVelocity = v; VehicleMinLinearVelocitySquared = v * v; } ), | ||
601 | new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", | 658 | new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", |
602 | 12.0f, | 659 | 12.0f, |
603 | (s) => { return (float)VehicleMaxAngularVelocity; }, | 660 | (s) => { return (float)VehicleMaxAngularVelocity; }, |
@@ -709,6 +766,33 @@ public static class BSParam | |||
709 | new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", | 766 | new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", |
710 | false ), | 767 | false ), |
711 | 768 | ||
769 | new ParameterDefn<float>("WhichHACD", "zero if Bullet HACD, non-zero says VHACD", | ||
770 | 0f ), | ||
771 | new ParameterDefn<float>("VHACDresolution", "max number of voxels generated during voxelization stage", | ||
772 | 100000f ), | ||
773 | new ParameterDefn<float>("VHACDdepth", "max number of clipping stages", | ||
774 | 20f ), | ||
775 | new ParameterDefn<float>("VHACDconcavity", "maximum concavity", | ||
776 | 0.0025f ), | ||
777 | new ParameterDefn<float>("VHACDplaneDownsampling", "granularity of search for best clipping plane", | ||
778 | 4f ), | ||
779 | new ParameterDefn<float>("VHACDconvexHullDownsampling", "precision of hull gen process", | ||
780 | 4f ), | ||
781 | new ParameterDefn<float>("VHACDalpha", "bias toward clipping along symmetry planes", | ||
782 | 0.05f ), | ||
783 | new ParameterDefn<float>("VHACDbeta", "bias toward clipping along revolution axis", | ||
784 | 0.05f ), | ||
785 | new ParameterDefn<float>("VHACDgamma", "max concavity when merging", | ||
786 | 0.00125f ), | ||
787 | new ParameterDefn<float>("VHACDpca", "on/off normalizing mesh before decomp", | ||
788 | 0f ), | ||
789 | new ParameterDefn<float>("VHACDmode", "0:voxel based, 1: tetrahedron based", | ||
790 | 0f ), | ||
791 | new ParameterDefn<float>("VHACDmaxNumVerticesPerCH", "max triangles per convex hull", | ||
792 | 64f ), | ||
793 | new ParameterDefn<float>("VHACDminVolumePerCH", "sampling of generated convex hulls", | ||
794 | 0.0001f ), | ||
795 | |||
712 | new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", | 796 | new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", |
713 | (float)BSLinkset.LinksetImplementation.Compound ), | 797 | (float)BSLinkset.LinksetImplementation.Compound ), |
714 | new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same", | 798 | new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same", |