diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 9 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 21 |
3 files changed, 30 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 6d5e23f..478aeab 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -853,7 +853,14 @@ public sealed class BSCharacter : BSPhysObject | |||
853 | { | 853 | { |
854 | _position = entprop.Position; | 854 | _position = entprop.Position; |
855 | _orientation = entprop.Rotation; | 855 | _orientation = entprop.Rotation; |
856 | _velocity = entprop.Velocity; | 856 | |
857 | // Smooth velocity. OpenSimulator is very sensitive to changes in velocity of the avatar | ||
858 | // and will send agent updates to the clients if velocity changes by more than | ||
859 | // 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many | ||
860 | // extra updates. | ||
861 | if (!entprop.Velocity.ApproxEquals(_velocity, 0.1f)) | ||
862 | _velocity = entprop.Velocity; | ||
863 | |||
857 | _acceleration = entprop.Acceleration; | 864 | _acceleration = entprop.Acceleration; |
858 | _rotationalVelocity = entprop.RotationalVelocity; | 865 | _rotationalVelocity = entprop.RotationalVelocity; |
859 | 866 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index bac0427..5353c75 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -141,7 +141,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
141 | 141 | ||
142 | // It can be confusing for an actor to know if it should move or update an object | 142 | // It can be confusing for an actor to know if it should move or update an object |
143 | // depeneding on the setting of 'selected', 'physical, ... | 143 | // depeneding on the setting of 'selected', 'physical, ... |
144 | // This flag is the true test -- if true, the object is being acted on in the physical world | 144 | // This flag is the true test -- if true, the object is being acted on in the physical world |
145 | public abstract bool IsPhysicallyActive { get; } | 145 | public abstract bool IsPhysicallyActive { get; } |
146 | 146 | ||
147 | // Materialness | 147 | // Materialness |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 7aa2d92..aaa6fe5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -502,6 +502,12 @@ public sealed class BSPrim : BSPhysObject | |||
502 | RegisterPreStepAction("BSPrim.setForce", LocalID, | 502 | RegisterPreStepAction("BSPrim.setForce", LocalID, |
503 | delegate(float timeStep) | 503 | delegate(float timeStep) |
504 | { | 504 | { |
505 | if (!IsPhysicallyActive) | ||
506 | { | ||
507 | UnRegisterPreStepAction("BSPrim.setForce", LocalID); | ||
508 | return; | ||
509 | } | ||
510 | |||
505 | DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); | 511 | DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); |
506 | if (PhysBody.HasPhysicalBody) | 512 | if (PhysBody.HasPhysicalBody) |
507 | { | 513 | { |
@@ -627,6 +633,12 @@ public sealed class BSPrim : BSPhysObject | |||
627 | RegisterPreStepAction("BSPrim.setTorque", LocalID, | 633 | RegisterPreStepAction("BSPrim.setTorque", LocalID, |
628 | delegate(float timeStep) | 634 | delegate(float timeStep) |
629 | { | 635 | { |
636 | if (!IsPhysicallyActive) | ||
637 | { | ||
638 | UnRegisterPreStepAction("BSPrim.setTorque", LocalID); | ||
639 | return; | ||
640 | } | ||
641 | |||
630 | if (PhysBody.HasPhysicalBody) | 642 | if (PhysBody.HasPhysicalBody) |
631 | AddAngularForce(_torque, false, true); | 643 | AddAngularForce(_torque, false, true); |
632 | } | 644 | } |
@@ -1061,6 +1073,12 @@ public sealed class BSPrim : BSPhysObject | |||
1061 | 1073 | ||
1062 | RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep) | 1074 | RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep) |
1063 | { | 1075 | { |
1076 | if (!IsPhysicallyActive) | ||
1077 | { | ||
1078 | UnRegisterPreStepAction("BSPrim.PIDTarget", LocalID); | ||
1079 | return; | ||
1080 | } | ||
1081 | |||
1064 | OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) | 1082 | OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) |
1065 | 1083 | ||
1066 | // 'movePosition' is where we'd like the prim to be at this moment. | 1084 | // 'movePosition' is where we'd like the prim to be at this moment. |
@@ -1108,6 +1126,9 @@ public sealed class BSPrim : BSPhysObject | |||
1108 | 1126 | ||
1109 | RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep) | 1127 | RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep) |
1110 | { | 1128 | { |
1129 | if (!IsPhysicallyActive) | ||
1130 | return; | ||
1131 | |||
1111 | _hoverMotor.SetCurrent(RawPosition.Z); | 1132 | _hoverMotor.SetCurrent(RawPosition.Z); |
1112 | _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight()); | 1133 | _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight()); |
1113 | float targetHeight = _hoverMotor.Step(timeStep); | 1134 | float targetHeight = _hoverMotor.Step(timeStep); |