diff options
author | Teravus Ovares | 2007-12-26 17:16:47 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-26 17:16:47 +0000 |
commit | f852b6455550569d002d0b1c527249f3f7894326 (patch) | |
tree | 95abccc4ae8529dc8c1b2aa283ac44e952f7dda7 /OpenSim/Region | |
parent | * Patch by Melanie to fix CreateSelected (diff) | |
download | opensim-SC_OLD-f852b6455550569d002d0b1c527249f3f7894326.zip opensim-SC_OLD-f852b6455550569d002d0b1c527249f3f7894326.tar.gz opensim-SC_OLD-f852b6455550569d002d0b1c527249f3f7894326.tar.bz2 opensim-SC_OLD-f852b6455550569d002d0b1c527249f3f7894326.tar.xz |
* This update includes a wide range of changes to the ODEPlugin for avatar movement, including:
** - avatar can navigate stairs better now
** - avatar can land without shooting into the air
** - excessive collisions with the ground are tempered somewhat and should only shoot the avatar up 20m instead of 200m
** - Try Catched a TextureDownloadModule.cs array out of bounds error with a report that causes it not to crash the sim, however it reports a few important items for tracking it down.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 22 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 50 |
5 files changed, 86 insertions, 43 deletions
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index d126569..0adace1 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -319,7 +319,15 @@ namespace OpenSim.Region.Environment.Modules | |||
319 | int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); | 319 | int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); |
320 | if (size > 1000) size = 1000; | 320 | if (size > 1000) size = 1000; |
321 | im.ImageData.Data = new byte[size]; | 321 | im.ImageData.Data = new byte[size]; |
322 | Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); | 322 | try |
323 | { | ||
324 | Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); | ||
325 | } | ||
326 | catch (System.ArgumentOutOfRangeException) | ||
327 | { | ||
328 | OpenSim.Framework.Console.MainLog.Instance.Warn("TEXTURE", "Unable to separate texture into multiple packets: Array bounds failure on asset:" + m_asset.FullID.ToString() + "- TextureDownloadModule.cs. line:328"); | ||
329 | return; | ||
330 | } | ||
323 | RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); | 331 | RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); |
324 | PacketCounter++; | 332 | PacketCounter++; |
325 | } | 333 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 5570136..03f1a70 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -999,17 +999,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
999 | if (m_physicsActor.Flying) | 999 | if (m_physicsActor.Flying) |
1000 | { | 1000 | { |
1001 | direc *= 4; | 1001 | direc *= 4; |
1002 | bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1002 | //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
1003 | bool colliding = (m_physicsActor.IsColliding==true); | 1003 | //bool colliding = (m_physicsActor.IsColliding==true); |
1004 | if (controlland) | 1004 | //if (controlland) |
1005 | MainLog.Instance.Verbose("AGENT","landCommand"); | 1005 | // MainLog.Instance.Verbose("AGENT","landCommand"); |
1006 | if (colliding ) | 1006 | //if (colliding ) |
1007 | MainLog.Instance.Verbose("AGENT","colliding"); | 1007 | // MainLog.Instance.Verbose("AGENT","colliding"); |
1008 | if (m_physicsActor.Flying && colliding && controlland) | 1008 | //if (m_physicsActor.Flying && colliding && controlland) |
1009 | { | 1009 | //{ |
1010 | StopFlying(); | 1010 | // StopFlying(); |
1011 | MainLog.Instance.Verbose("AGENT", "Stop FLying"); | 1011 | // MainLog.Instance.Verbose("AGENT", "Stop FLying"); |
1012 | } | 1012 | //} |
1013 | } | 1013 | } |
1014 | else | 1014 | else |
1015 | { | 1015 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 33b2e4f..9676db4 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -111,22 +111,22 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero); | 114 | //Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero); |
115 | d.JointAttach(Amotor, Body, IntPtr.Zero); | 115 | //d.JointAttach(Amotor, Body, IntPtr.Zero); |
116 | d.JointSetAMotorMode(Amotor, dAMotorEuler); | 116 | //d.JointSetAMotorMode(Amotor, dAMotorEuler); |
117 | d.JointSetAMotorNumAxes(Amotor, 3); | 117 | //d.JointSetAMotorNumAxes(Amotor, 3); |
118 | d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0); | 118 | //d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0); |
119 | d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0); | 119 | //d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0); |
120 | d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1); | 120 | ///d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1); |
121 | d.JointSetAMotorAngle(Amotor, 0, 0); | 121 | //d.JointSetAMotorAngle(Amotor, 0, 0); |
122 | d.JointSetAMotorAngle(Amotor, 1, 0); | 122 | //d.JointSetAMotorAngle(Amotor, 1, 0); |
123 | d.JointSetAMotorAngle(Amotor, 2, 0); | 123 | //d.JointSetAMotorAngle(Amotor, 2, 0); |
124 | d.JointSetAMotorParam(Amotor, 0, -0); | 124 | //d.JointSetAMotorParam(Amotor, 0, -0); |
125 | d.JointSetAMotorParam(Amotor, 0x200, -0); | 125 | //d.JointSetAMotorParam(Amotor, 0x200, -0); |
126 | d.JointSetAMotorParam(Amotor, 0x100, -0); | 126 | //d.JointSetAMotorParam(Amotor, 0x100, -0); |
127 | d.JointSetAMotorParam(Amotor, 0, 0); | 127 | // d.JointSetAMotorParam(Amotor, 0, 0); |
128 | d.JointSetAMotorParam(Amotor, 3, 0); | 128 | // d.JointSetAMotorParam(Amotor, 3, 0); |
129 | d.JointSetAMotorParam(Amotor, 2, 0); | 129 | // d.JointSetAMotorParam(Amotor, 2, 0); |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
@@ -269,7 +269,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
269 | m_pidControllerActive = true; | 269 | m_pidControllerActive = true; |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | public void SetPidStatus(bool status) | |
273 | { | ||
274 | m_pidControllerActive = status; | ||
275 | } | ||
273 | public override PhysicsVector Position | 276 | public override PhysicsVector Position |
274 | { | 277 | { |
275 | get { return _position; } | 278 | get { return _position; } |
@@ -583,7 +586,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
583 | { | 586 | { |
584 | lock (OdeScene.OdeLock) | 587 | lock (OdeScene.OdeLock) |
585 | { | 588 | { |
586 | d.JointDestroy(Amotor); | 589 | // d.JointDestroy(Amotor); |
587 | d.GeomDestroy(Shell); | 590 | d.GeomDestroy(Shell); |
588 | _parent_scene.geom_name_map.Remove(Shell); | 591 | _parent_scene.geom_name_map.Remove(Shell); |
589 | d.BodyDestroy(Body); | 592 | d.BodyDestroy(Body); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 32a9fc7..35328b8 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -375,14 +375,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
375 | { | 375 | { |
376 | string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); | 376 | string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); |
377 | int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | 377 | int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
378 | if (primScenAvatarIn == "0") | ||
379 | { | ||
380 | MainLog.Instance.Verbose("Physics", "Prim " + m_primName + " in space with no prim: " + primScenAvatarIn + ". Expected to be at: " + m_targetSpace.ToString() + " . Arr:': " + arrayitem[0].ToString() + "," + arrayitem[1].ToString()); | ||
381 | } | ||
382 | else | ||
383 | { | ||
384 | MainLog.Instance.Verbose("Physics", "Prim " + m_primName + " in Prim space with prim: " + primScenAvatarIn + ". Expected to be at: " + m_targetSpace.ToString() + ". Arr:" + arrayitem[0].ToString() + "," + arrayitem[1].ToString()); | ||
385 | } | ||
386 | m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); | 378 | m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); |
387 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 379 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
388 | d.SpaceAdd(m_targetSpace, prim_geom); | 380 | d.SpaceAdd(m_targetSpace, prim_geom); |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 51c0e15..8bb822e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -136,7 +136,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
136 | TerrainContact.surface.soft_erp = 0.1025f; | 136 | TerrainContact.surface.soft_erp = 0.1025f; |
137 | 137 | ||
138 | AvatarMovementprimContact.surface.mu = 150.0f; | 138 | AvatarMovementprimContact.surface.mu = 150.0f; |
139 | AvatarMovementprimContact.surface.bounce = 0.2f; | 139 | AvatarMovementprimContact.surface.bounce = 0.1f; |
140 | 140 | ||
141 | AvatarMovementTerrainContact.surface.mode |= d.ContactFlags.SoftERP; | 141 | AvatarMovementTerrainContact.surface.mode |= d.ContactFlags.SoftERP; |
142 | AvatarMovementTerrainContact.surface.mu = 150.0f; | 142 | AvatarMovementTerrainContact.surface.mu = 150.0f; |
@@ -297,7 +297,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
297 | { | 297 | { |
298 | p2.CollidingObj = true; | 298 | p2.CollidingObj = true; |
299 | //contacts[i].depth = 0.003f; | 299 | //contacts[i].depth = 0.003f; |
300 | //p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); | 300 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); |
301 | OdeCharacter character = (OdeCharacter)p2; | ||
302 | character.SetPidStatus(true); | ||
301 | //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); | 303 | //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); |
302 | 304 | ||
303 | } | 305 | } |
@@ -309,8 +311,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
309 | { | 311 | { |
310 | p1.CollidingObj = true; | 312 | p1.CollidingObj = true; |
311 | //contacts[i].depth = 0.003f; | 313 | //contacts[i].depth = 0.003f; |
312 | //p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); | 314 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); |
313 | //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2)); | 315 | //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2)); |
316 | OdeCharacter character = (OdeCharacter)p2; | ||
317 | character.SetPidStatus(true); | ||
314 | } | 318 | } |
315 | else | 319 | else |
316 | { | 320 | { |
@@ -321,12 +325,48 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
321 | if (p1.PhysicsActorType == (int)ActorTypes.Prim && p2.PhysicsActorType == (int)ActorTypes.Prim) | 325 | if (p1.PhysicsActorType == (int)ActorTypes.Prim && p2.PhysicsActorType == (int)ActorTypes.Prim) |
322 | { | 326 | { |
323 | // Don't collide, one or both prim will explode. | 327 | // Don't collide, one or both prim will explode. |
324 | contacts[i].depth = 0.0f; | 328 | contacts[i].depth = -1f; |
329 | } | ||
330 | if (contacts[i].depth >= 1.00f) | ||
331 | { | ||
332 | if ((p2.PhysicsActorType == (int)ActorTypes.Agent && p1.PhysicsActorType == (int)ActorTypes.Unknown) || (p1.PhysicsActorType == (int)ActorTypes.Agent && p2.PhysicsActorType == (int)ActorTypes.Unknown)) | ||
333 | { | ||
334 | |||
335 | if (p2.PhysicsActorType == (int)ActorTypes.Agent) | ||
336 | { | ||
337 | OdeCharacter character = (OdeCharacter)p2; | ||
338 | |||
339 | //p2.CollidingObj = true; | ||
340 | contacts[i].depth = 0.003f; | ||
341 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); | ||
342 | contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); | ||
343 | character.SetPidStatus(true); | ||
344 | |||
345 | } | ||
346 | else | ||
347 | { | ||
348 | |||
349 | } | ||
350 | if (p1.PhysicsActorType == (int)ActorTypes.Agent) | ||
351 | { | ||
352 | OdeCharacter character = (OdeCharacter)p2; | ||
353 | |||
354 | //p2.CollidingObj = true; | ||
355 | contacts[i].depth = 0.003f; | ||
356 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); | ||
357 | contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); | ||
358 | character.SetPidStatus(true); | ||
359 | } | ||
360 | else | ||
361 | { | ||
362 | //contacts[i].depth = 0.0000000f; | ||
363 | } | ||
364 | } | ||
325 | } | 365 | } |
326 | } | 366 | } |
327 | #endregion | 367 | #endregion |
328 | 368 | ||
329 | if (contacts[i].depth > 0f) | 369 | if (contacts[i].depth >= 0f) |
330 | { | 370 | { |
331 | if (name1 == "Terrain" || name2 == "Terrain") | 371 | if (name1 == "Terrain" || name2 == "Terrain") |
332 | { | 372 | { |