aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs39
1 files changed, 21 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 296c554..ada81b5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -89,8 +89,7 @@ namespace OpenSim.Region.Framework.Scenes
89 89
90 private bool m_updateflag; 90 private bool m_updateflag;
91 private byte m_movementflag; 91 private byte m_movementflag;
92 //private readonly List<NewForce> m_forcesList = new List<NewForce>(); 92 private readonly List<NewForce> m_forcesList = new List<NewForce>();
93 private NewForce m_nextVelocity = new NewForce();
94 private short m_updateCount; 93 private short m_updateCount;
95 private uint m_requestedSitTargetID; 94 private uint m_requestedSitTargetID;
96 private UUID m_requestedSitTargetUUID = UUID.Zero; 95 private UUID m_requestedSitTargetUUID = UUID.Zero;
@@ -139,7 +138,7 @@ namespace OpenSim.Region.Framework.Scenes
139 public string JID = string.Empty; 138 public string JID = string.Empty;
140 139
141 // Agent moves with a PID controller causing a force to be exerted. 140 // Agent moves with a PID controller causing a force to be exerted.
142 private bool m_newMovement; 141 private bool m_newForce;
143 private bool m_newCoarseLocations = true; 142 private bool m_newCoarseLocations = true;
144 private float m_health = 100f; 143 private float m_health = 100f;
145 144
@@ -2227,6 +2226,7 @@ namespace OpenSim.Region.Framework.Scenes
2227 m_perfMonMS = Environment.TickCount; 2226 m_perfMonMS = Environment.TickCount;
2228 2227
2229 m_rotation = rotation; 2228 m_rotation = rotation;
2229 NewForce newVelocity = new NewForce();
2230 Vector3 direc = vec * rotation; 2230 Vector3 direc = vec * rotation;
2231 direc.Normalize(); 2231 direc.Normalize();
2232 2232
@@ -2261,12 +2261,10 @@ namespace OpenSim.Region.Framework.Scenes
2261 } 2261 }
2262 } 2262 }
2263 2263
2264 lock (m_nextVelocity) 2264 newVelocity.X = direc.X;
2265 { 2265 newVelocity.Y = direc.Y;
2266 m_nextVelocity.X = direc.X; 2266 newVelocity.Z = direc.Z;
2267 m_nextVelocity.Y = direc.Y; 2267 m_forcesList.Add(newVelocity);
2268 m_nextVelocity.Z = direc.Z;
2269 }
2270 2268
2271 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2269 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2272 } 2270 }
@@ -2287,11 +2285,10 @@ namespace OpenSim.Region.Framework.Scenes
2287 2285
2288 if (m_isChildAgent == false) 2286 if (m_isChildAgent == false)
2289 { 2287 {
2290 if (m_newMovement) // user movement 'forces' (ie commands to move) 2288 if (m_newForce) // user movement 'forces' (ie commands to move)
2291 { 2289 {
2292 SendTerseUpdateToAllClients(); 2290 SendTerseUpdateToAllClients();
2293 m_updateCount = 0; 2291 m_updateCount = 0;
2294 m_newMovement = false;
2295 } 2292 }
2296 else if (m_movementflag != 0) // scripted movement (?) 2293 else if (m_movementflag != 0) // scripted movement (?)
2297 { 2294 {
@@ -3139,17 +3136,20 @@ namespace OpenSim.Region.Framework.Scenes
3139 /// </summary> 3136 /// </summary>
3140 public override void UpdateMovement() 3137 public override void UpdateMovement()
3141 { 3138 {
3142 // m_newMovement = false; 3139 m_newForce = false;
3143 if ((m_nextVelocity.X != movementvector.X) || (m_nextVelocity.Y != movementvector.Y) || (m_nextVelocity.Z != movementvector.Z)) 3140 lock (m_forcesList)
3144 { 3141 {
3145 lock (m_nextVelocity) 3142 if (m_forcesList.Count > 0)
3146 { 3143 {
3144 //we are only interested in the last velocity added to the list [Although they are called forces, they are actually velocities]
3145 NewForce force = m_forcesList[m_forcesList.Count - 1];
3146
3147 m_updateflag = true; 3147 m_updateflag = true;
3148 try 3148 try
3149 { 3149 {
3150 movementvector.X = m_nextVelocity.X; 3150 movementvector.X = force.X;
3151 movementvector.Y = m_nextVelocity.Y; 3151 movementvector.Y = force.Y;
3152 movementvector.Z = m_nextVelocity.Z; 3152 movementvector.Z = force.Z;
3153 Velocity = movementvector; 3153 Velocity = movementvector;
3154 } 3154 }
3155 catch (NullReferenceException) 3155 catch (NullReferenceException)
@@ -3158,7 +3158,9 @@ namespace OpenSim.Region.Framework.Scenes
3158 // Ignoring this causes no movement to be sent to the physics engine... 3158 // Ignoring this causes no movement to be sent to the physics engine...
3159 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter! 3159 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
3160 } 3160 }
3161 m_newMovement = true; 3161 m_newForce = true;
3162
3163 m_forcesList.Clear();
3162 } 3164 }
3163 } 3165 }
3164 } 3166 }
@@ -3265,6 +3267,7 @@ namespace OpenSim.Region.Framework.Scenes
3265 3267
3266 public void Close() 3268 public void Close()
3267 { 3269 {
3270
3268 lock (m_attachments) 3271 lock (m_attachments)
3269 { 3272 {
3270 // Delete attachments from scene 3273 // Delete attachments from scene