diff options
author | Melanie | 2013-01-23 02:38:59 +0000 |
---|---|---|
committer | Melanie | 2013-01-23 02:38:59 +0000 |
commit | cc4cfd9fa81fa8e7c7254bd3c35e67ef9cb20dad (patch) | |
tree | 0854a68c0329c37b9eedea56b3bf65458c59b696 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | BulletSim: Tweeks to vehicle motion. (diff) | |
download | opensim-SC-cc4cfd9fa81fa8e7c7254bd3c35e67ef9cb20dad.zip opensim-SC-cc4cfd9fa81fa8e7c7254bd3c35e67ef9cb20dad.tar.gz opensim-SC-cc4cfd9fa81fa8e7c7254bd3c35e67ef9cb20dad.tar.bz2 opensim-SC-cc4cfd9fa81fa8e7c7254bd3c35e67ef9cb20dad.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/Physics/BulletSNPlugin/BSShapeCollection.cs
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 34 |
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 | } |