From 86e3fc3da2921e47a8ee7a41a41f89633504719a Mon Sep 17 00:00:00 2001 From: dan miller Date: Sun, 9 Sep 2007 21:21:09 +0000 Subject: [PATCH] added avatar updates for physics movement -- fixes gravity & avatar collision (ODE) --- OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- .../Region/Environment/Scenes/ScenePresence.cs | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 17b01d5d46..1af41be924 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -251,7 +251,7 @@ namespace OpenSim.Region.Environment.Scenes { if (phyScene.IsThreaded) { - phyScene.GetResults(); + phyScene.GetResults(); /// no engines implement this, and what does it have to do with threading? possible DEAD CODE } List moveEntities = new List(Entities.Values); diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 8cf0b98b15..a32ddef288 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -72,6 +72,7 @@ namespace OpenSim.Region.Environment.Scenes private IScenePresenceBody m_body; private Vector3[] Dir_Vectors = new Vector3[6]; + private libsecondlife.LLVector3 lastPhysPos = new libsecondlife.LLVector3(); private enum Dir_ControlFlags { DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS, @@ -463,18 +464,22 @@ namespace OpenSim.Region.Environment.Scenes { this.SendPrimUpdates(); - if (this.newCoarseLocations) { - this.SendCoarseLocations(); - this.newCoarseLocations = false; + if (this.newCoarseLocations) { + this.SendCoarseLocations(); + this.newCoarseLocations = false; } if (this.childAgent == false) { + + /// check for user movement 'forces' (ie commands to move) if (this.newForce) { this.SendTerseUpdateToALLClients(); _updateCount = 0; } + + /// check for scripted movement (?) else if (movementflag != 0) { _updateCount++; @@ -485,6 +490,13 @@ namespace OpenSim.Region.Environment.Scenes } } + /// check for physics-related movement + else if (this.lastPhysPos.GetDistanceTo(this.AbsolutePosition) > 0.02 ) + { + this.SendTerseUpdateToALLClients(); + _updateCount = 0; + this.lastPhysPos = this.AbsolutePosition; + } this.CheckForSignificantMovement(); this.CheckForBorderCrossing();