aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs34
1 files changed, 21 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index aaa6fe5..e6b8507 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -311,13 +311,14 @@ public sealed class BSPrim : BSPhysObject
311 _position = value; 311 _position = value;
312 PositionSanityCheck(false); 312 PositionSanityCheck(false);
313 313
314 // A linkset might need to know if a component information changed.
315 Linkset.UpdateProperties(this, false);
316
317 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() 314 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
318 { 315 {
319 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 316 DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
320 ForcePosition = _position; 317 ForcePosition = _position;
318
319 // A linkset might need to know if a component information changed.
320 Linkset.UpdateProperties(UpdatedProperties.Position, this);
321
321 }); 322 });
322 } 323 }
323 } 324 }
@@ -682,12 +683,13 @@ public sealed class BSPrim : BSPhysObject
682 return; 683 return;
683 _orientation = value; 684 _orientation = value;
684 685
685 // A linkset might need to know if a component information changed.
686 Linkset.UpdateProperties(this, false);
687
688 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() 686 PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate()
689 { 687 {
690 ForceOrientation = _orientation; 688 ForceOrientation = _orientation;
689
690 // A linkset might need to know if a component information changed.
691 Linkset.UpdateProperties(UpdatedProperties.Orientation, this);
692
691 }); 693 });
692 } 694 }
693 } 695 }
@@ -989,10 +991,10 @@ public sealed class BSPrim : BSPhysObject
989 } 991 }
990 set { 992 set {
991 _rotationalVelocity = value; 993 _rotationalVelocity = value;
994 Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity);
992 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); 995 // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
993 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() 996 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
994 { 997 {
995 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
996 ForceRotationalVelocity = _rotationalVelocity; 998 ForceRotationalVelocity = _rotationalVelocity;
997 }); 999 });
998 } 1000 }
@@ -1005,7 +1007,9 @@ public sealed class BSPrim : BSPhysObject
1005 _rotationalVelocity = value; 1007 _rotationalVelocity = value;
1006 if (PhysBody.HasPhysicalBody) 1008 if (PhysBody.HasPhysicalBody)
1007 { 1009 {
1010 DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
1008 PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); 1011 PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity);
1012 // PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
1009 ActivateIfPhysical(false); 1013 ActivateIfPhysical(false);
1010 } 1014 }
1011 } 1015 }
@@ -1082,7 +1086,7 @@ public sealed class BSPrim : BSPhysObject
1082 OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) 1086 OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below)
1083 1087
1084 // 'movePosition' is where we'd like the prim to be at this moment. 1088 // 'movePosition' is where we'd like the prim to be at this moment.
1085 OMV.Vector3 movePosition = _targetMotor.Step(timeStep); 1089 OMV.Vector3 movePosition = RawPosition + _targetMotor.Step(timeStep);
1086 1090
1087 // If we are very close to our target, turn off the movement motor. 1091 // If we are very close to our target, turn off the movement motor.
1088 if (_targetMotor.ErrorIsZero()) 1092 if (_targetMotor.ErrorIsZero())
@@ -1193,10 +1197,14 @@ public sealed class BSPrim : BSPhysObject
1193 public override float APIDDamping { set { return; } } 1197 public override float APIDDamping { set { return; } }
1194 1198
1195 public override void AddForce(OMV.Vector3 force, bool pushforce) { 1199 public override void AddForce(OMV.Vector3 force, bool pushforce) {
1200 // Per documentation, max force is limited.
1201 OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
1202
1196 // Since this force is being applied in only one step, make this a force per second. 1203 // Since this force is being applied in only one step, make this a force per second.
1197 OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep; 1204 addForce /= PhysicsScene.LastTimeStep;
1198 AddForce(addForce, pushforce, false); 1205 AddForce(addForce, pushforce, false /* inTaintTime */);
1199 } 1206 }
1207
1200 // Applying a force just adds this to the total force on the object. 1208 // Applying a force just adds this to the total force on the object.
1201 // This added force will only last the next simulation tick. 1209 // This added force will only last the next simulation tick.
1202 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { 1210 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
@@ -1205,9 +1213,9 @@ public sealed class BSPrim : BSPhysObject
1205 { 1213 {
1206 if (force.IsFinite()) 1214 if (force.IsFinite())
1207 { 1215 {
1208 OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
1209 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); 1216 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
1210 1217
1218 OMV.Vector3 addForce = force;
1211 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1219 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
1212 { 1220 {
1213 // Bullet adds this central force to the total force for this tick 1221 // Bullet adds this central force to the total force for this tick
@@ -1642,7 +1650,7 @@ public sealed class BSPrim : BSPhysObject
1642 // TODO: handle physics introduced by Bullet with computed vehicle physics. 1650 // TODO: handle physics introduced by Bullet with computed vehicle physics.
1643 if (_vehicle.IsActive) 1651 if (_vehicle.IsActive)
1644 { 1652 {
1645 entprop.RotationalVelocity = OMV.Vector3.Zero; 1653 // entprop.RotationalVelocity = OMV.Vector3.Zero;
1646 } 1654 }
1647 1655
1648 // Assign directly to the local variables so the normal set actions do not happen 1656 // Assign directly to the local variables so the normal set actions do not happen
@@ -1681,7 +1689,7 @@ public sealed class BSPrim : BSPhysObject
1681 */ 1689 */
1682 1690
1683 // The linkset implimentation might want to know about this. 1691 // The linkset implimentation might want to know about this.
1684 Linkset.UpdateProperties(this, true); 1692 Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this);
1685 } 1693 }
1686} 1694}
1687} 1695}