diff options
author | Teravus Ovares | 2008-02-17 10:41:08 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-17 10:41:08 +0000 |
commit | 19e0ada93af347cff93a3950f66abe245399f8b2 (patch) | |
tree | 7578573f583e3037e19fc2db471209ea172f0b1c /OpenSim/Region | |
parent | Thank you very much, ChrisDown for a patch to (diff) | |
download | opensim-SC-19e0ada93af347cff93a3950f66abe245399f8b2.zip opensim-SC-19e0ada93af347cff93a3950f66abe245399f8b2.tar.gz opensim-SC-19e0ada93af347cff93a3950f66abe245399f8b2.tar.bz2 opensim-SC-19e0ada93af347cff93a3950f66abe245399f8b2.tar.xz |
* Located and destroyed the weird velocity and rotation transfers. It turned out to be that the Static PhysicsVector.Zero was transferring velocities between all non fixed objects. Not so static after all :(. Finding it was cruel and unusual punishment from the CLR.
* Therefore, when you run through a pile of prim you won't see things rotate when they're not supposed to anymore.
* Avatars don't float off either.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/CollisionLocker.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 10 |
9 files changed, 76 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 2b02ab9..67b07f6 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -77,8 +77,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
77 | private bool m_newForce = false; | 77 | private bool m_newForce = false; |
78 | private bool m_newCoarseLocations = true; | 78 | private bool m_newCoarseLocations = true; |
79 | private bool m_gotAllObjectsInScene = false; | 79 | private bool m_gotAllObjectsInScene = false; |
80 | |||
81 | 80 | ||
81 | private bool m_lastPhysicsStoppedStatus = false; | ||
82 | |||
83 | private LLVector3 m_lastVelocity = LLVector3.Zero; | ||
84 | |||
82 | // Default AV Height | 85 | // Default AV Height |
83 | private float m_avHeight = 127.0f; | 86 | private float m_avHeight = 127.0f; |
84 | 87 | ||
@@ -1263,11 +1266,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1263 | m_updateCount = 0; | 1266 | m_updateCount = 0; |
1264 | } | 1267 | } |
1265 | } | 1268 | } |
1266 | else if (Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) // physics-related movement | 1269 | else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement |
1267 | { | 1270 | { |
1271 | |||
1272 | |||
1273 | // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity | ||
1274 | // doing the above assures us that we know what we sent the clients last | ||
1268 | SendTerseUpdateToAllClients(); | 1275 | SendTerseUpdateToAllClients(); |
1269 | m_updateCount = 0; | 1276 | m_updateCount = 0; |
1270 | lastPhysPos = AbsolutePosition; | 1277 | |
1278 | |||
1279 | |||
1271 | } | 1280 | } |
1272 | 1281 | ||
1273 | // followed suggestion from mic bowman. reversed the two lines below. | 1282 | // followed suggestion from mic bowman. reversed the two lines below. |
@@ -1308,6 +1317,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1308 | 1317 | ||
1309 | m_scene.Broadcast(SendTerseUpdateToClient); | 1318 | m_scene.Broadcast(SendTerseUpdateToClient); |
1310 | 1319 | ||
1320 | m_lastVelocity = m_velocity; | ||
1321 | lastPhysPos = AbsolutePosition; | ||
1322 | |||
1311 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); | 1323 | m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); |
1312 | 1324 | ||
1313 | } | 1325 | } |
@@ -1729,7 +1741,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1729 | AbsolutePosition.Z); | 1741 | AbsolutePosition.Z); |
1730 | 1742 | ||
1731 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec); | 1743 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec); |
1732 | m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 1744 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
1733 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 1745 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
1734 | } | 1746 | } |
1735 | 1747 | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index d767eab..3fb30fb 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -274,6 +274,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
274 | set { return; } | 274 | set { return; } |
275 | } | 275 | } |
276 | 276 | ||
277 | public override bool Stopped | ||
278 | { | ||
279 | get { return false; } | ||
280 | } | ||
281 | |||
282 | |||
277 | public override PhysicsVector Position | 283 | public override PhysicsVector Position |
278 | { | 284 | { |
279 | get { return _position; } | 285 | get { return _position; } |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 314708f..f5f222b 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -730,6 +730,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
730 | _name = name; | 730 | _name = name; |
731 | } | 731 | } |
732 | 732 | ||
733 | public override bool Stopped | ||
734 | { | ||
735 | get { return false; } | ||
736 | } | ||
737 | |||
733 | public override PhysicsVector Position | 738 | public override PhysicsVector Position |
734 | { | 739 | { |
735 | get { return _position; } | 740 | get { return _position; } |
diff --git a/OpenSim/Region/Physics/Manager/CollisionLocker.cs b/OpenSim/Region/Physics/Manager/CollisionLocker.cs index 8c2e702..98e9736 100644 --- a/OpenSim/Region/Physics/Manager/CollisionLocker.cs +++ b/OpenSim/Region/Physics/Manager/CollisionLocker.cs | |||
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Physics.Manager | |||
35 | public class CollisionLocker | 35 | public class CollisionLocker |
36 | { | 36 | { |
37 | 37 | ||
38 | private bool locked = false; | 38 | |
39 | private List<IntPtr> worldlock = new List<IntPtr>(); | 39 | private List<IntPtr> worldlock = new List<IntPtr>(); |
40 | public CollisionLocker() | 40 | public CollisionLocker() |
41 | { | 41 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 97eccba..b96ce27 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -118,6 +118,8 @@ namespace OpenSim.Region.Physics.Manager | |||
118 | get { return new NullPhysicsActor(); } | 118 | get { return new NullPhysicsActor(); } |
119 | } | 119 | } |
120 | 120 | ||
121 | public abstract bool Stopped { get; } | ||
122 | |||
121 | public abstract PhysicsVector Size { get; set; } | 123 | public abstract PhysicsVector Size { get; set; } |
122 | 124 | ||
123 | public abstract PrimitiveBaseShape Shape { set; } | 125 | public abstract PrimitiveBaseShape Shape { set; } |
@@ -204,6 +206,11 @@ namespace OpenSim.Region.Physics.Manager | |||
204 | 206 | ||
205 | public class NullPhysicsActor : PhysicsActor | 207 | public class NullPhysicsActor : PhysicsActor |
206 | { | 208 | { |
209 | public override bool Stopped | ||
210 | { | ||
211 | get{ return false; } | ||
212 | } | ||
213 | |||
207 | public override PhysicsVector Position | 214 | public override PhysicsVector Position |
208 | { | 215 | { |
209 | get { return PhysicsVector.Zero; } | 216 | get { return PhysicsVector.Zero; } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 6b8d0e2..0f1446c 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -317,6 +317,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
317 | m_pidControllerActive = status; | 317 | m_pidControllerActive = status; |
318 | } | 318 | } |
319 | 319 | ||
320 | public override bool Stopped | ||
321 | { | ||
322 | get { return _zeroFlag; } | ||
323 | } | ||
324 | |||
320 | /// <summary> | 325 | /// <summary> |
321 | /// This 'puts' an avatar somewhere in the physics space. | 326 | /// This 'puts' an avatar somewhere in the physics space. |
322 | /// Not really a good choice unless you 'know' it's a good | 327 | /// Not really a good choice unless you 'know' it's a good |
@@ -509,8 +514,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
509 | public override PhysicsVector Velocity | 514 | public override PhysicsVector Velocity |
510 | { | 515 | { |
511 | get { | 516 | get { |
517 | // There's a problem with PhysicsVector.Zero! Don't Use it Here! | ||
512 | if (_zeroFlag) | 518 | if (_zeroFlag) |
513 | return PhysicsVector.Zero; | 519 | return new PhysicsVector(0f, 0f, 0f); |
514 | m_lastUpdateSent = false; | 520 | m_lastUpdateSent = false; |
515 | return _velocity; | 521 | return _velocity; |
516 | } | 522 | } |
@@ -756,7 +762,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
756 | if (!m_lastUpdateSent) | 762 | if (!m_lastUpdateSent) |
757 | { | 763 | { |
758 | m_lastUpdateSent = true; | 764 | m_lastUpdateSent = true; |
759 | base.RequestPhysicsterseUpdate(); | 765 | //base.RequestPhysicsterseUpdate(); |
760 | 766 | ||
761 | } | 767 | } |
762 | } | 768 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index fae5316..b41153b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -1129,6 +1129,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1129 | set { m_throttleUpdates = value; } | 1129 | set { m_throttleUpdates = value; } |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | public override bool Stopped | ||
1133 | { | ||
1134 | get { return _zeroFlag; } | ||
1135 | } | ||
1136 | |||
1132 | public override PhysicsVector Position | 1137 | public override PhysicsVector Position |
1133 | { | 1138 | { |
1134 | get { return _position; } | 1139 | get { return _position; } |
@@ -1233,12 +1238,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1233 | public override PhysicsVector RotationalVelocity | 1238 | public override PhysicsVector RotationalVelocity |
1234 | { | 1239 | { |
1235 | get { | 1240 | get { |
1241 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | ||
1236 | if (_zeroFlag) | 1242 | if (_zeroFlag) |
1237 | return PhysicsVector.Zero; | 1243 | return pv; |
1238 | m_lastUpdateSent = false; | 1244 | m_lastUpdateSent = false; |
1239 | 1245 | ||
1240 | if (m_rotationalVelocity.IsIdentical(PhysicsVector.Zero, 0.2f)) | 1246 | if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) |
1241 | return PhysicsVector.Zero; | 1247 | return pv; |
1242 | 1248 | ||
1243 | return m_rotationalVelocity; | 1249 | return m_rotationalVelocity; |
1244 | } | 1250 | } |
@@ -1261,7 +1267,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1261 | public void UpdatePositionAndVelocity() | 1267 | public void UpdatePositionAndVelocity() |
1262 | { | 1268 | { |
1263 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 1269 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
1264 | 1270 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | |
1265 | if (Body != (IntPtr) 0) | 1271 | if (Body != (IntPtr) 0) |
1266 | { | 1272 | { |
1267 | d.Vector3 vec = d.BodyGetPosition(Body); | 1273 | d.Vector3 vec = d.BodyGetPosition(Body); |
@@ -1348,7 +1354,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1348 | { | 1354 | { |
1349 | m_throttleUpdates = false; | 1355 | m_throttleUpdates = false; |
1350 | throttleCounter = 0; | 1356 | throttleCounter = 0; |
1351 | m_rotationalVelocity = PhysicsVector.Zero; | 1357 | m_rotationalVelocity = pv; |
1352 | base.RequestPhysicsterseUpdate(); | 1358 | base.RequestPhysicsterseUpdate(); |
1353 | m_lastUpdateSent = true; | 1359 | m_lastUpdateSent = true; |
1354 | } | 1360 | } |
@@ -1362,9 +1368,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1362 | _velocity.X = vel.X; | 1368 | _velocity.X = vel.X; |
1363 | _velocity.Y = vel.Y; | 1369 | _velocity.Y = vel.Y; |
1364 | _velocity.Z = vel.Z; | 1370 | _velocity.Z = vel.Z; |
1365 | if (_velocity.IsIdentical(PhysicsVector.Zero, 0.5f)) | 1371 | if (_velocity.IsIdentical(pv, 0.5f)) |
1366 | { | 1372 | { |
1367 | m_rotationalVelocity = PhysicsVector.Zero; | 1373 | m_rotationalVelocity = pv; |
1368 | } | 1374 | } |
1369 | else | 1375 | else |
1370 | { | 1376 | { |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 3bd25f6..bac61f4 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -403,6 +403,11 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
403 | set { return; } | 403 | set { return; } |
404 | } | 404 | } |
405 | 405 | ||
406 | public override bool Stopped | ||
407 | { | ||
408 | get { return false; } | ||
409 | } | ||
410 | |||
406 | public override PhysicsVector Position | 411 | public override PhysicsVector Position |
407 | { | 412 | { |
408 | get { return _position; } | 413 | get { return _position; } |
@@ -545,6 +550,11 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
545 | set { return; } | 550 | set { return; } |
546 | } | 551 | } |
547 | 552 | ||
553 | public override bool Stopped | ||
554 | { | ||
555 | get { return false; } | ||
556 | } | ||
557 | |||
548 | public override PhysicsVector Position | 558 | public override PhysicsVector Position |
549 | { | 559 | { |
550 | get { return _position; } | 560 | get { return _position; } |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 4a0467c..ffa0838 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -279,6 +279,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
279 | set { m_rotationalVelocity = value; } | 279 | set { m_rotationalVelocity = value; } |
280 | } | 280 | } |
281 | 281 | ||
282 | public override bool Stopped | ||
283 | { | ||
284 | get { return false; } | ||
285 | } | ||
286 | |||
282 | public override PhysicsVector Position | 287 | public override PhysicsVector Position |
283 | { | 288 | { |
284 | get { return _position; } | 289 | get { return _position; } |
@@ -479,6 +484,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
479 | set { return; } | 484 | set { return; } |
480 | } | 485 | } |
481 | 486 | ||
487 | public override bool Stopped | ||
488 | { | ||
489 | get { return false; } | ||
490 | } | ||
491 | |||
482 | public override PhysicsVector Position | 492 | public override PhysicsVector Position |
483 | { | 493 | { |
484 | get | 494 | get |