diff options
author | Robert Adams | 2013-01-09 11:06:49 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-11 16:46:38 -0800 |
commit | 98168edc29c7c761121e453d82bf1fab52814b58 (patch) | |
tree | 6bc2841797c64b34ffde221345ff6b7f9acb7c7a /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | BulletSim: fix the 'No recognised physics mesh found ...' error spew by remem... (diff) | |
download | opensim-SC-98168edc29c7c761121e453d82bf1fab52814b58.zip opensim-SC-98168edc29c7c761121e453d82bf1fab52814b58.tar.gz opensim-SC-98168edc29c7c761121e453d82bf1fab52814b58.tar.bz2 opensim-SC-98168edc29c7c761121e453d82bf1fab52814b58.tar.xz |
BulletSim: remove double application of buoyancy. Centralize computation of buoyancy. Add motor angular debugging controls.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 8fd054f..50ba343 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -410,7 +410,7 @@ public sealed class BSPrim : BSPhysObject | |||
410 | } | 410 | } |
411 | else | 411 | else |
412 | { | 412 | { |
413 | OMV.Vector3 grav = ComputeGravity(); | 413 | OMV.Vector3 grav = ComputeGravity(Buoyancy); |
414 | 414 | ||
415 | if (inWorld) | 415 | if (inWorld) |
416 | { | 416 | { |
@@ -445,12 +445,12 @@ public sealed class BSPrim : BSPhysObject | |||
445 | } | 445 | } |
446 | 446 | ||
447 | // Return what gravity should be set to this very moment | 447 | // Return what gravity should be set to this very moment |
448 | private OMV.Vector3 ComputeGravity() | 448 | public OMV.Vector3 ComputeGravity(float buoyancy) |
449 | { | 449 | { |
450 | OMV.Vector3 ret = PhysicsScene.DefaultGravity; | 450 | OMV.Vector3 ret = PhysicsScene.DefaultGravity; |
451 | 451 | ||
452 | if (!IsStatic) | 452 | if (!IsStatic) |
453 | ret *= (1f - Buoyancy); | 453 | ret *= (1f - buoyancy); |
454 | 454 | ||
455 | return ret; | 455 | return ret; |
456 | } | 456 | } |
@@ -1561,21 +1561,6 @@ public sealed class BSPrim : BSPhysObject | |||
1561 | 1561 | ||
1562 | // The physics engine says that properties have updated. Update same and inform | 1562 | // The physics engine says that properties have updated. Update same and inform |
1563 | // the world that things have changed. | 1563 | // the world that things have changed. |
1564 | // TODO: do we really need to check for changed? Maybe just copy values and call RequestPhysicsterseUpdate() | ||
1565 | enum UpdatedProperties { | ||
1566 | Position = 1 << 0, | ||
1567 | Rotation = 1 << 1, | ||
1568 | Velocity = 1 << 2, | ||
1569 | Acceleration = 1 << 3, | ||
1570 | RotationalVel = 1 << 4 | ||
1571 | } | ||
1572 | |||
1573 | const float ROTATION_TOLERANCE = 0.01f; | ||
1574 | const float VELOCITY_TOLERANCE = 0.001f; | ||
1575 | const float POSITION_TOLERANCE = 0.05f; | ||
1576 | const float ACCELERATION_TOLERANCE = 0.01f; | ||
1577 | const float ROTATIONAL_VELOCITY_TOLERANCE = 0.01f; | ||
1578 | |||
1579 | public override void UpdateProperties(EntityProperties entprop) | 1564 | public override void UpdateProperties(EntityProperties entprop) |
1580 | { | 1565 | { |
1581 | // Updates only for individual prims and for the root object of a linkset. | 1566 | // Updates only for individual prims and for the root object of a linkset. |
@@ -1588,7 +1573,7 @@ public sealed class BSPrim : BSPhysObject | |||
1588 | entprop.RotationalVelocity = OMV.Vector3.Zero; | 1573 | entprop.RotationalVelocity = OMV.Vector3.Zero; |
1589 | } | 1574 | } |
1590 | 1575 | ||
1591 | // Assign directly to the local variables so the normal set action does not happen | 1576 | // Assign directly to the local variables so the normal set actions do not happen |
1592 | _position = entprop.Position; | 1577 | _position = entprop.Position; |
1593 | _orientation = entprop.Rotation; | 1578 | _orientation = entprop.Rotation; |
1594 | _velocity = entprop.Velocity; | 1579 | _velocity = entprop.Velocity; |