From 62dd67b8b8a7eb441d57f2b854444fbc5c4767d3 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sat, 20 Dec 2008 21:36:42 +0000 Subject: Mantis#2796. Thank you kindly, Gerhard for a patch that addresses: On a call of llVolumeDetect(1) (or any other number !=0) volume detection is enabled. Together with VD, the phantom flag is set to the GUI. On a call of llVolumeDetect(0), vd detection is switched of again, also the phantom state is removed. On a call to llSetState(STATE_PHANTOM, false) while VD is active, also VD is switched off. The same is true for unchecking the phantom flag via GUI. This allows to take back VD without the need to script just by removing the phantom flag. Things missing in this patch: persistance of the volume-detection flag. This needs more discussion and will be included in another patch soon. --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 7 ++++++- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 6f5abfa..b9c0936 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -127,6 +127,8 @@ namespace OpenSim.Region.Physics.OdePlugin private bool m_isphysical = false; private bool m_isSelected = false; + internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively + private bool m_throttleUpdates = false; private int throttleCounter = 0; public int m_interpenetrationcount = 0; @@ -2226,7 +2228,10 @@ namespace OpenSim.Region.Physics.OdePlugin public override void SetVolumeDetect(int param) { - + lock (_parent_scene.OdeLock) + { + m_isVolumeDetect = (param!=0); + } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 7589750..c0b4b45 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -797,7 +797,25 @@ namespace OpenSim.Region.Physics.OdePlugin #endregion - if (contacts[i].depth >= 0f && !checkDupe(contacts[i], p2.PhysicsActorType)) + // Logic for collision handling + // Note, that if *all* contacts are skipped (VolumeDetect) + // The prim still detects (and forwards) collision events but + // appears to be phantom for the world + Boolean skipThisContact = false; + + if (contacts[i].depth < 0f) + skipThisContact = true; + + if (checkDupe(contacts[i], p2.PhysicsActorType)) + skipThisContact = true; + + if ((p1 is OdePrim) && (((OdePrim)p1).m_isVolumeDetect)) + skipThisContact = true; // No collision on volume detect prims + + if ((p2 is OdePrim) && (((OdePrim)p2).m_isVolumeDetect)) + skipThisContact = true; // No collision on volume detect prims + + if (!skipThisContact) { // If we're colliding against terrain if (name1 == "Terrain" || name2 == "Terrain") -- cgit v1.1