diff options
author | Teravus Ovares | 2007-12-22 05:43:34 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-22 05:43:34 +0000 |
commit | de32006f9a0843c9d115fc6c2c92d64046f52ee0 (patch) | |
tree | bbf3414bcc1cb3c9cb88da40be986b399fce6cc5 /OpenSim/Region | |
parent | Vanity commit (diff) | |
download | opensim-SC-de32006f9a0843c9d115fc6c2c92d64046f52ee0.zip opensim-SC-de32006f9a0843c9d115fc6c2c92d64046f52ee0.tar.gz opensim-SC-de32006f9a0843c9d115fc6c2c92d64046f52ee0.tar.bz2 opensim-SC-de32006f9a0843c9d115fc6c2c92d64046f52ee0.tar.xz |
* Added smoother handling of interpenetrating physical objects.
* Fixes:
* -- duplicating Active physical object causes objects to explode in opposite directions
* -- Rezzing objects too close to you avatar causes avatar to shoot around in odd directions
* Vanity
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 85 |
3 files changed, 69 insertions, 21 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 79803a5..89dc130 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -332,6 +332,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
332 | // If agent is a root agent. | 332 | // If agent is a root agent. |
333 | if (!agent.IsChildAgent) | 333 | if (!agent.IsChildAgent) |
334 | { | 334 | { |
335 | |||
335 | //agent.ControllingClient.new | 336 | //agent.ControllingClient.new |
336 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | 337 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); |
337 | InformClientOfNeighbor(agent, otherRegion); | 338 | InformClientOfNeighbor(agent, otherRegion); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 04bf9a0..3bdf180 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -174,7 +174,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
174 | } | 174 | } |
175 | if (m_wascolliding != m_iscolliding) | 175 | if (m_wascolliding != m_iscolliding) |
176 | { | 176 | { |
177 | base.SendCollisionUpdate(new CollisionEventUpdate()); | 177 | //base.SendCollisionUpdate(new CollisionEventUpdate()); |
178 | 178 | ||
179 | } | 179 | } |
180 | m_wascolliding = m_iscolliding; | 180 | m_wascolliding = m_iscolliding; |
@@ -527,7 +527,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
527 | if (_velocity.Z < -6 && !m_hackSentFall) | 527 | if (_velocity.Z < -6 && !m_hackSentFall) |
528 | { | 528 | { |
529 | m_hackSentFall = true; | 529 | m_hackSentFall = true; |
530 | base.SendCollisionUpdate(new CollisionEventUpdate()); | 530 | //base.SendCollisionUpdate(new CollisionEventUpdate()); |
531 | m_pidControllerActive = false; | 531 | m_pidControllerActive = false; |
532 | } | 532 | } |
533 | else if (flying && !m_hackSentFly) | 533 | else if (flying && !m_hackSentFly) |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 305a930..b4336c3 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -281,38 +281,85 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
281 | break; | 281 | break; |
282 | } | 282 | } |
283 | 283 | ||
284 | if (name1 == "Terrain" || name2 == "Terrain") | 284 | // we don't want prim or avatar to explode |
285 | #region InterPenetration Handling - Unintended physics explosions | ||
286 | if (contacts[i].depth >= 0.08f) | ||
285 | { | 287 | { |
286 | if ((p2.PhysicsActorType == (int)ActorTypes.Agent) && (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) | 288 | if (contacts[i].depth >= 1.00f) |
287 | { | 289 | { |
288 | AvatarMovementTerrainContact.geom = contacts[i]; | 290 | //MainLog.Instance.Debug("PHYSICS",contacts[i].depth.ToString()); |
289 | joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact); | ||
290 | } | 291 | } |
291 | else | 292 | // If you interpenetrate a prim with an agent |
293 | if ((p2.PhysicsActorType == (int)ActorTypes.Agent && p1.PhysicsActorType == (int)ActorTypes.Prim) || (p1.PhysicsActorType == (int)ActorTypes.Agent && p2.PhysicsActorType == (int)ActorTypes.Prim)) | ||
292 | { | 294 | { |
293 | TerrainContact.geom = contacts[i]; | 295 | |
294 | joint = d.JointCreateContact(world, contactgroup, ref TerrainContact); | 296 | if (p2.PhysicsActorType == (int)ActorTypes.Agent) |
297 | { | ||
298 | p2.CollidingObj = true; | ||
299 | contacts[i].depth = 0.003f; | ||
300 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); | ||
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)); | ||
302 | |||
303 | } | ||
304 | else | ||
305 | { | ||
306 | contacts[i].depth = 0.0000000f; | ||
307 | } | ||
308 | if (p1.PhysicsActorType == (int)ActorTypes.Agent) | ||
309 | { | ||
310 | p1.CollidingObj = true; | ||
311 | contacts[i].depth = 0.003f; | ||
312 | 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)); | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | contacts[i].depth = 0.0000000f; | ||
318 | } | ||
319 | } | ||
320 | // If you interpenetrate a prim with another prim | ||
321 | if (p1.PhysicsActorType == (int)ActorTypes.Prim && p2.PhysicsActorType == (int)ActorTypes.Prim) | ||
322 | { | ||
323 | // Don't collide, one or both prim will explode. | ||
324 | contacts[i].depth = 0.0f; | ||
295 | } | 325 | } |
296 | } | 326 | } |
297 | else | 327 | #endregion |
328 | |||
329 | if (contacts[i].depth > 0f) | ||
298 | { | 330 | { |
299 | if ((p2.PhysicsActorType == (int)ActorTypes.Agent) && (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) | 331 | if (name1 == "Terrain" || name2 == "Terrain") |
300 | { | 332 | { |
301 | AvatarMovementprimContact.geom = contacts[i]; | 333 | |
302 | joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact); | 334 | if ((p2.PhysicsActorType == (int)ActorTypes.Agent) && (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) |
335 | { | ||
336 | AvatarMovementTerrainContact.geom = contacts[i]; | ||
337 | joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact); | ||
338 | |||
339 | } | ||
340 | else | ||
341 | { | ||
342 | TerrainContact.geom = contacts[i]; | ||
343 | joint = d.JointCreateContact(world, contactgroup, ref TerrainContact); | ||
344 | } | ||
303 | } | 345 | } |
304 | else | 346 | else |
305 | { | 347 | { |
306 | contact.geom = contacts[i]; | 348 | if ((p2.PhysicsActorType == (int)ActorTypes.Agent) && (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) |
307 | joint = d.JointCreateContact(world, contactgroup, ref contact); | 349 | { |
350 | AvatarMovementprimContact.geom = contacts[i]; | ||
351 | joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact); | ||
352 | |||
353 | } | ||
354 | else | ||
355 | { | ||
356 | contact.geom = contacts[i]; | ||
357 | joint = d.JointCreateContact(world, contactgroup, ref contact); | ||
358 | } | ||
308 | } | 359 | } |
360 | d.JointAttach(joint, b1, b2); | ||
309 | } | 361 | } |
310 | 362 | ||
311 | |||
312 | d.JointAttach(joint, b1, b2); | ||
313 | |||
314 | |||
315 | |||
316 | if (count > 3) | 363 | if (count > 3) |
317 | { | 364 | { |
318 | p2.ThrottleUpdates = true; | 365 | p2.ThrottleUpdates = true; |
@@ -334,7 +381,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
334 | } | 381 | } |
335 | // If the sim is running slow this frame, | 382 | // If the sim is running slow this frame, |
336 | // don't process collision for prim! | 383 | // don't process collision for prim! |
337 | if (timeStep < (m_SkipFramesAtms / 2)) | 384 | if (timeStep < (m_SkipFramesAtms / 3)) |
338 | { | 385 | { |
339 | foreach (OdePrim chr in _activeprims) | 386 | foreach (OdePrim chr in _activeprims) |
340 | { | 387 | { |