diff options
author | Robert Adams | 2013-07-24 10:52:54 -0700 |
---|---|---|
committer | Robert Adams | 2013-07-30 07:22:43 -0700 |
commit | 5a7784a0e6c3f549d0e7b59380ad05729cb93a4f (patch) | |
tree | 99b327c183b30b613da2368237fe6726d112623f /OpenSim/Region/Physics/BulletSPlugin | |
parent | minor: Add timeout secs to connection timeout message. Change message to ref... (diff) | |
download | opensim-SC-5a7784a0e6c3f549d0e7b59380ad05729cb93a4f.zip opensim-SC-5a7784a0e6c3f549d0e7b59380ad05729cb93a4f.tar.gz opensim-SC-5a7784a0e6c3f549d0e7b59380ad05729cb93a4f.tar.bz2 opensim-SC-5a7784a0e6c3f549d0e7b59380ad05729cb93a4f.tar.xz |
BulletSim: make density display and return value consistant with how
the simulator expects it (scaled to 100kg/m^3).
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 2 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 13 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 15 |
3 files changed, 22 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 59e7f5f..58a417e 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -75,7 +75,7 @@ public sealed class BSCharacter : BSPhysObject | |||
75 | RawVelocity = OMV.Vector3.Zero; | 75 | RawVelocity = OMV.Vector3.Zero; |
76 | _buoyancy = ComputeBuoyancyFromFlying(isFlying); | 76 | _buoyancy = ComputeBuoyancyFromFlying(isFlying); |
77 | Friction = BSParam.AvatarStandingFriction; | 77 | Friction = BSParam.AvatarStandingFriction; |
78 | Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor; | 78 | Density = BSParam.AvatarDensity; |
79 | 79 | ||
80 | // Old versions of ScenePresence passed only the height. If width and/or depth are zero, | 80 | // Old versions of ScenePresence passed only the height. If width and/or depth are zero, |
81 | // replace with the default values. | 81 | // replace with the default values. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 0bdb5f1..4520171 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -463,7 +463,7 @@ public static class BSParam | |||
463 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. | 463 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. |
464 | // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well | 464 | // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well |
465 | new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", | 465 | new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", |
466 | 0.0001f ), | 466 | 0.01f ), |
467 | 467 | ||
468 | new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", | 468 | new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", |
469 | 2200f ), | 469 | 2200f ), |
@@ -474,8 +474,9 @@ public static class BSParam | |||
474 | 0.2f, | 474 | 0.2f, |
475 | (s) => { return DefaultFriction; }, | 475 | (s) => { return DefaultFriction; }, |
476 | (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), | 476 | (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), |
477 | // For historical reasons, the viewer and simulator multiply the density by 100 | ||
477 | new ParameterDefn<float>("DefaultDensity", "Density for new objects" , | 478 | new ParameterDefn<float>("DefaultDensity", "Density for new objects" , |
478 | 10.000006836f, // Aluminum g/cm3 | 479 | 1000.0006836f, // Aluminum g/cm3 * 100 |
479 | (s) => { return DefaultDensity; }, | 480 | (s) => { return DefaultDensity; }, |
480 | (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), | 481 | (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), |
481 | new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , | 482 | new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , |
@@ -555,8 +556,9 @@ public static class BSParam | |||
555 | 0.95f ), | 556 | 0.95f ), |
556 | new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", | 557 | new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", |
557 | 1.3f ), | 558 | 1.3f ), |
558 | new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", | 559 | // For historical reasons, density is reported * 100 |
559 | 3.5f) , | 560 | new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation. Scaled times 100.", |
561 | 3500f) , // 3.5 * 100 | ||
560 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 562 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
561 | 0f ), | 563 | 0f ), |
562 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", | 564 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", |
@@ -608,9 +610,8 @@ public static class BSParam | |||
608 | 0.0f ), | 610 | 0.0f ), |
609 | new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", | 611 | new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", |
610 | 0.0f ), | 612 | 0.0f ), |
611 | // Turn off fudge with DensityScaleFactor = 0.0001. Value used to be 0.2f; | ||
612 | new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", | 613 | new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", |
613 | 1.0f ), | 614 | 0.2f ), |
614 | new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", | 615 | new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", |
615 | 60.0f ), | 616 | 60.0f ), |
616 | new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", | 617 | new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect", |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index d34b797..0704591 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -187,10 +187,23 @@ public abstract class BSPhysObject : PhysicsActor | |||
187 | MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false); | 187 | MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false); |
188 | Friction = matAttrib.friction; | 188 | Friction = matAttrib.friction; |
189 | Restitution = matAttrib.restitution; | 189 | Restitution = matAttrib.restitution; |
190 | Density = matAttrib.density / BSParam.DensityScaleFactor; | 190 | Density = matAttrib.density; |
191 | // DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density); | 191 | // DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density); |
192 | } | 192 | } |
193 | 193 | ||
194 | public override float Density | ||
195 | { | ||
196 | get | ||
197 | { | ||
198 | return base.Density; | ||
199 | } | ||
200 | set | ||
201 | { | ||
202 | DetailLog("{0},BSPhysObject.Density,set,den={1}", LocalID, value); | ||
203 | base.Density = value; | ||
204 | } | ||
205 | } | ||
206 | |||
194 | // Stop all physical motion. | 207 | // Stop all physical motion. |
195 | public abstract void ZeroMotion(bool inTaintTime); | 208 | public abstract void ZeroMotion(bool inTaintTime); |
196 | public abstract void ZeroAngularMotion(bool inTaintTime); | 209 | public abstract void ZeroAngularMotion(bool inTaintTime); |