review llCastRay V3 phantom detection. Make it ignore physics shape type none as physics engines do.
parent
aa9a56d4df
commit
b4bbf4f95d
|
@ -15010,7 +15010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
int rejectTypes = 0;
|
int rejectTypes = 0;
|
||||||
int dataFlags = 0;
|
int dataFlags = 0;
|
||||||
int maxHits = 1;
|
int maxHits = 1;
|
||||||
bool detectPhantom = false;
|
bool notdetectPhantom = true;
|
||||||
for (int i = 0; i < options.Length; i += 2)
|
for (int i = 0; i < options.Length; i += 2)
|
||||||
{
|
{
|
||||||
if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
|
if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
|
||||||
|
@ -15020,7 +15020,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
|
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
|
||||||
maxHits = options.GetLSLIntegerItem(i + 1);
|
maxHits = options.GetLSLIntegerItem(i + 1);
|
||||||
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
|
else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
|
||||||
detectPhantom = (options.GetLSLIntegerItem(i + 1) != 0);
|
notdetectPhantom = (options.GetLSLIntegerItem(i + 1) == 0);
|
||||||
}
|
}
|
||||||
if (maxHits > m_maxHitsInCastRay)
|
if (maxHits > m_maxHitsInCastRay)
|
||||||
maxHits = m_maxHitsInCastRay;
|
maxHits = m_maxHitsInCastRay;
|
||||||
|
@ -15050,42 +15050,45 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
World.ForEachSOG(
|
World.ForEachSOG(
|
||||||
delegate(SceneObjectGroup group)
|
delegate(SceneObjectGroup group)
|
||||||
{
|
{
|
||||||
|
if(group.IsDeleted || group.RootPart == null)
|
||||||
|
return;
|
||||||
// Check group filters unless part filters are configured
|
// Check group filters unless part filters are configured
|
||||||
bool isPhysical = (group.RootPart != null && group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical);
|
bool isPhysical = (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical);
|
||||||
bool isNonphysical = !isPhysical;
|
bool isNonphysical = !isPhysical;
|
||||||
bool isPhantom = group.IsPhantom || group.IsVolumeDetect;
|
bool isPhantom = group.IsPhantom || group.IsVolumeDetect;
|
||||||
bool isAttachment = group.IsAttachment;
|
bool isAttachment = group.IsAttachment;
|
||||||
bool doGroup = true;
|
|
||||||
if (isPhysical && rejectPhysical)
|
if (isPhysical && rejectPhysical)
|
||||||
doGroup = false;
|
return;
|
||||||
if (isNonphysical && rejectNonphysical)
|
if (isNonphysical && rejectNonphysical)
|
||||||
doGroup = false;
|
return;
|
||||||
if (isPhantom && detectPhantom)
|
if (isPhantom && notdetectPhantom)
|
||||||
doGroup = true;
|
return;
|
||||||
if (m_filterPartsInCastRay)
|
if (m_filterPartsInCastRay)
|
||||||
doGroup = true;
|
return;
|
||||||
if (isAttachment && !m_doAttachmentsInCastRay)
|
if (isAttachment && !m_doAttachmentsInCastRay)
|
||||||
doGroup = false;
|
return;
|
||||||
|
|
||||||
// Parse object/group if passed filters
|
// Parse object/group if passed filters
|
||||||
if (doGroup)
|
|
||||||
{
|
|
||||||
// Iterate over all prims/parts in object/group
|
// Iterate over all prims/parts in object/group
|
||||||
foreach(SceneObjectPart part in group.Parts)
|
foreach(SceneObjectPart part in group.Parts)
|
||||||
{
|
{
|
||||||
// Check part filters if configured
|
// Check part filters if configured
|
||||||
if (m_filterPartsInCastRay)
|
if (m_filterPartsInCastRay)
|
||||||
{
|
{
|
||||||
|
// ignore PhysicsShapeType.None as physics engines do
|
||||||
|
// or we will get into trouble in future
|
||||||
|
if(part.PhysicsShapeType == (byte)PhysicsShapeType.None)
|
||||||
|
continue;
|
||||||
isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical);
|
isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical);
|
||||||
isNonphysical = !isPhysical;
|
isNonphysical = !isPhysical;
|
||||||
isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || (part.VolumeDetectActive);
|
isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) ||
|
||||||
bool doPart = true;
|
(part.VolumeDetectActive);
|
||||||
|
|
||||||
if (isPhysical && rejectPhysical)
|
if (isPhysical && rejectPhysical)
|
||||||
doPart = false;
|
continue;
|
||||||
if (isNonphysical && rejectNonphysical)
|
if (isNonphysical && rejectNonphysical)
|
||||||
doPart = false;
|
continue;
|
||||||
if (isPhantom && detectPhantom)
|
if (isPhantom && notdetectPhantom)
|
||||||
doPart = true;
|
|
||||||
if (!doPart)
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15203,7 +15206,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check avatar filter
|
// Check avatar filter
|
||||||
|
|
Loading…
Reference in New Issue