diff options
author | dan miller | 2007-09-21 02:31:36 +0000 |
---|---|---|
committer | dan miller | 2007-09-21 02:31:36 +0000 |
commit | d3050724d8fdb0de5b87285b782de9c4d2f9bac7 (patch) | |
tree | 2d7f2fa65b1e4dcf70b6d7c52a3336a4148d0a60 | |
parent | * Removed Unused 'Entity' superclass (diff) | |
download | opensim-SC-d3050724d8fdb0de5b87285b782de9c4d2f9bac7.zip opensim-SC-d3050724d8fdb0de5b87285b782de9c4d2f9bac7.tar.gz opensim-SC-d3050724d8fdb0de5b87285b782de9c4d2f9bac7.tar.bz2 opensim-SC-d3050724d8fdb0de5b87285b782de9c4d2f9bac7.tar.xz |
physics-related fixes; should stabilize border crossings
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 14 |
3 files changed, 29 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 5b08155..d89ca28 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -833,6 +833,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
833 | if (presence.PhysicsActor != null) | 833 | if (presence.PhysicsActor != null) |
834 | { | 834 | { |
835 | phyScene.RemoveAvatar(presence.PhysicsActor); | 835 | phyScene.RemoveAvatar(presence.PhysicsActor); |
836 | presence.PhysicsActor = null; | ||
836 | } | 837 | } |
837 | }); | 838 | }); |
838 | 839 | ||
@@ -1028,7 +1029,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1028 | { | 1029 | { |
1029 | if (m_scenePresences.ContainsKey(agentID)) | 1030 | if (m_scenePresences.ContainsKey(agentID)) |
1030 | { | 1031 | { |
1031 | m_scenePresences[agentID].MakeAvatar(position, isFlying); | 1032 | m_scenePresences[agentID].MakeAvatarPhysical(position, isFlying); |
1032 | } | 1033 | } |
1033 | } | 1034 | } |
1034 | } | 1035 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index c0b9a35..1a38244 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -336,7 +336,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | public void MakeAvatar(LLVector3 pos, bool isFlying) | 339 | public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) |
340 | { | 340 | { |
341 | newAvatar = true; | 341 | newAvatar = true; |
342 | childAgent = false; | 342 | childAgent = false; |
@@ -363,6 +363,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
363 | private void RemoveFromPhysicalScene() | 363 | private void RemoveFromPhysicalScene() |
364 | { | 364 | { |
365 | m_scene.PhysScene.RemoveAvatar( this.PhysicsActor ); | 365 | m_scene.PhysScene.RemoveAvatar( this.PhysicsActor ); |
366 | this.PhysicsActor = null; | ||
366 | } | 367 | } |
367 | 368 | ||
368 | /// <summary> | 369 | /// <summary> |
@@ -429,6 +430,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
429 | /// <param name="pack"></param> | 430 | /// <param name="pack"></param> |
430 | public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) | 431 | public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) |
431 | { | 432 | { |
433 | if (childAgent) | ||
434 | { | ||
435 | Console.WriteLine("DEBUG: HandleAgentUpdate: child agent"); | ||
436 | return; | ||
437 | } | ||
438 | if(PhysicsActor==null) { | ||
439 | Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); | ||
440 | return; | ||
441 | } | ||
432 | int i = 0; | 442 | int i = 0; |
433 | bool update_movementflag = false; | 443 | bool update_movementflag = false; |
434 | bool update_rotation = false; | 444 | bool update_rotation = false; |
@@ -501,6 +511,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
501 | 511 | ||
502 | protected void AddNewMovement(Vector3 vec, Quaternion rotation) | 512 | protected void AddNewMovement(Vector3 vec, Quaternion rotation) |
503 | { | 513 | { |
514 | if (childAgent) | ||
515 | { | ||
516 | Console.WriteLine("DEBUG: AddNewMovement: child agent"); | ||
517 | return; | ||
518 | } | ||
504 | NewForce newVelocity = new NewForce(); | 519 | NewForce newVelocity = new NewForce(); |
505 | Vector3 direc = rotation*vec; | 520 | Vector3 direc = rotation*vec; |
506 | direc.Normalize(); | 521 | direc.Normalize(); |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 8b49f70..8d142ab 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -152,9 +152,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
152 | 152 | ||
153 | public override void RemoveAvatar(PhysicsActor actor) | 153 | public override void RemoveAvatar(PhysicsActor actor) |
154 | { | 154 | { |
155 | OdeCharacter och = (OdeCharacter)actor; | 155 | ((OdeCharacter)actor).Destroy(); |
156 | d.BodyDestroy(och.BoundingCapsule); | 156 | _characters.Remove((OdeCharacter)actor); |
157 | _characters.Remove(och); | ||
158 | } | 157 | } |
159 | 158 | ||
160 | public override void RemovePrim(PhysicsActor prim) | 159 | public override void RemovePrim(PhysicsActor prim) |
@@ -449,6 +448,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
449 | this._position.Y = vec.Y; | 448 | this._position.Y = vec.Y; |
450 | this._position.Z = vec.Z; | 449 | this._position.Z = vec.Z; |
451 | } | 450 | } |
451 | |||
452 | public void Destroy() | ||
453 | { | ||
454 | lock (OdeScene.OdeLock) | ||
455 | { | ||
456 | d.GeomDestroy(this.capsule_geom); | ||
457 | d.BodyDestroy(this.BoundingCapsule); | ||
458 | } | ||
459 | } | ||
452 | } | 460 | } |
453 | 461 | ||
454 | public class OdePrim : PhysicsActor | 462 | public class OdePrim : PhysicsActor |