本文整理汇总了C#中OpenSim.Framework.DetectedObject类的典型用法代码示例。如果您正苦于以下问题:C# DetectedObject类的具体用法?C# DetectedObject怎么用?C# DetectedObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DetectedObject类属于OpenSim.Framework命名空间,在下文中一共展示了DetectedObject类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PhysicsCollision
public void PhysicsCollision(EventArgs e)
{
// m_log.DebugFormat("Invoking PhysicsCollision on {0} {1} {2}", Name, LocalId, UUID);
// single threaded here
CollisionEventUpdate a = (CollisionEventUpdate)e;
Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList;
List<uint> thisHitColliders = new List<uint>();
List<uint> endedColliders = new List<uint>();
List<uint> startedColliders = new List<uint>();
// calculate things that started colliding this time
// and build up list of colliders this time
foreach (uint localid in collissionswith.Keys)
{
thisHitColliders.Add(localid);
if (!m_lastColliders.Contains(localid))
{
startedColliders.Add(localid);
}
//m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
}
// calculate things that ended colliding
foreach (uint localID in m_lastColliders)
{
if (!thisHitColliders.Contains(localID))
{
endedColliders.Add(localID);
}
}
//add the items that started colliding this time to the last colliders list.
foreach (uint localID in startedColliders)
{
m_lastColliders.Add(localID);
}
// remove things that ended colliding from the last colliders list
foreach (uint localID in endedColliders)
{
m_lastColliders.Remove(localID);
}
if (ParentGroup.IsDeleted)
return;
// play the sound.
if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
{
SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false);
}
if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
{
// do event notification
if (startedColliders.Count > 0)
{
ColliderArgs StartCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
if (localId == 0)
continue;
if (ParentGroup.Scene == null)
return;
SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
if (ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString())
|| ParentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
//If it is 1, it is to accept ONLY collisions from this object
if (found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj.OwnerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj.GroupID;
colliding.Add(detobj);
}
//If it is 0, it is to not accept collisions from this object
else
{
}
}
else
{
bool found = ParentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
//If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
if (!found)
//.........这里部分代码省略.........
示例2: CreateDetObject
private DetectedObject CreateDetObject(ScenePresence av)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
detobj.linkNumber = 0;
return detobj;
}
示例3: CreateDetObjectForGround
private DetectedObject CreateDetObjectForGround()
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = UUID.Zero;
detobj.nameStr = "";
detobj.ownerUUID = UUID.Zero;
detobj.posVector = AbsolutePosition;
detobj.rotQuat = Quaternion.Identity;
detobj.velVector = Vector3.Zero;
detobj.colliderType = 0;
detobj.groupUUID = UUID.Zero;
detobj.linkNumber = 0;
return detobj;
}
示例4: PhysicsCollision
public void PhysicsCollision(EventArgs e)
{
// single threaded here
if (e == null)
{
return;
}
CollisionEventUpdate a = (CollisionEventUpdate)e;
Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList;
List<uint> thisHitColliders = new List<uint>();
List<uint> endedColliders = new List<uint>();
List<uint> startedColliders = new List<uint>();
// calculate things that started colliding this time
// and build up list of colliders this time
foreach (uint localid in collissionswith.Keys)
{
if (localid != 0)
{
thisHitColliders.Add(localid);
if (!m_lastColliders.Contains(localid))
{
startedColliders.Add(localid);
}
//m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
}
}
// calculate things that ended colliding
foreach (uint localID in m_lastColliders)
{
if (!thisHitColliders.Contains(localID))
{
endedColliders.Add(localID);
}
}
//add the items that started colliding this time to the last colliders list.
foreach (uint localID in startedColliders)
{
m_lastColliders.Add(localID);
}
// remove things that ended colliding from the last colliders list
foreach (uint localID in endedColliders)
{
m_lastColliders.Remove(localID);
}
if (m_parentGroup == null)
return;
if (m_parentGroup.IsDeleted)
return;
// play the sound.
if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
{
SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0);
}
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
{
// do event notification
if (startedColliders.Count > 0)
{
ColliderArgs StartCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null)
return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
if (obj != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
else
{
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avlist.Length; i++)
{
ScenePresence av = avlist[i];
if (av.LocalId == localId)
{
//.........这里部分代码省略.........
示例5: CreateDetObjectForGround
private DetectedObject CreateDetObjectForGround()
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = UUID.Zero;
detobj.nameStr = "";
detobj.ownerUUID = UUID.Zero;
detobj.posVector = ParentGroup.RootPart.AbsolutePosition;
detobj.rotQuat = Quaternion.Identity;
detobj.velVector = Vector3.Zero;
detobj.colliderType = 0;
detobj.groupUUID = UUID.Zero;
detobj.linkNumber = LinkNum; // pass my link number not sure needed.. but no harm
return detobj;
}
示例6: TryExtractCollider
private void TryExtractCollider(uint localId, List<DetectedObject> colliding, bool isPrim, UUID fallbackUuid)
{
//TODO: this extracts a DetectedObject from the collision, BUT this is then further changed into a
//detectparams later making most of this information useless since the change will rediscover
//the colliding object again. I have no idea why opensim did it this way.
if (isPrim)
{
// always running this check because if the user deletes the object it would return a null reference.
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
if (obj != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.groupUUID = obj._groupID;
detobj.colliderType = (int)DetermineColliderType(obj);
detobj.linkNum = this.LinkNum;
colliding.Add(detobj);
}
else
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = fallbackUuid;
colliding.Add(detobj);
}
}
else
{
ScenePresence presence = m_parentGroup.Scene.GetScenePresence(localId);
if (presence != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = presence.UUID;
detobj.nameStr = presence.Firstname + " " + presence.Lastname;
detobj.ownerUUID = presence.UUID;
detobj.posVector = presence.AbsolutePosition;
detobj.rotQuat = presence.Rotation;
detobj.velVector = presence.Velocity;
detobj.linkNum = this.LinkNum;
detobj.colliderType = (int)DetectedType.Agent | (int)(presence.Velocity != OpenMetaverse.Vector3.Zero ? DetectedType.Active : DetectedType.Passive);
colliding.Add(detobj);
}
}
}
示例7: FromDetectedObject
public static DetectParams FromDetectedObject(DetectedObject detobj)
{
DetectParams parms = new DetectParams();
parms.Key = detobj.keyUUID;
parms.Group = detobj.groupUUID;
parms.LinkNum = detobj.linkNum;
parms.Name = detobj.nameStr;
parms.Owner = detobj.ownerUUID;
parms.Position = detobj.posVector;
parms.Rotation = detobj.rotQuat;
parms.Type = detobj.colliderType;
parms.Velocity = detobj.velVector;
return parms;
}
示例8: PhysicsCollision
//.........这里部分代码省略.........
else if (m_material == OpenMetaverse.Material.Rubber)
SendSound(SoundRubberCollision, 1, true, 0, 0, false, false);
else if (m_material == OpenMetaverse.Material.Stone)
SendSound(SoundStoneCollision, 1, true, 0, 0, false, false);
else if (m_material == OpenMetaverse.Material.Wood)
SendSound(SoundWoodCollision, 1, true, 0, 0, false, false);
break; //Play based on material type in prim2prim collisions
default:
break; //Unclear of what this object is, no sounds
}
}
if (CollisionSprite != UUID.Zero && CollisionSoundVolume > 0.0f) // The collision volume isn't a mistake, its an SL feature/bug
{
// TODO: make a sprite!
}
if (((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
(CollisionSound != UUID.Zero) ||
PassCollisions != 2)
{
if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0)
{
// do event notification
if (startedColliders.Count > 0)
{
ColliderArgs StartCollidingMessage = new ColliderArgs();
List<DetectedObject> colliding = new List<DetectedObject>();
foreach (uint localId in startedColliders)
{
if (localId == 0)
continue;
// always running this check because if the user deletes the object it would return a null reference.
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null)
return;
SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
string data = "";
if (obj != null)
{
if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
{
bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1, out data);
//If it is 1, it is to accept ONLY collisions from this object
if (found)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj._ownerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj._groupID;
colliding.Add(detobj);
}
示例9: BuildLandColliders
private void BuildLandColliders(SceneObjectPart collisionPart, OSDArray collisionUUIDs, RegionSyncModule pRegionContext)
{
for (int i = 0; i < collisionUUIDs.Count; i++)
{
OSD arg = collisionUUIDs[i];
UUID collidingUUID = arg.AsUUID();
if (collidingUUID.Equals(UUID.Zero))
{
//Hope that all is left is ground!
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = UUID.Zero;
detobj.nameStr = "";
detobj.ownerUUID = UUID.Zero;
detobj.posVector = collisionPart.ParentGroup.RootPart.AbsolutePosition;
detobj.rotQuat = Quaternion.Identity;
detobj.velVector = Vector3.Zero;
detobj.colliderType = 0;
detobj.groupUUID = UUID.Zero;
Colliders.Add(detobj);
}
}
}
示例10: BuildColliders
private void BuildColliders(OSDArray collisionUUIDs, RegionSyncModule pRegionContext)
{
for (int i = 0; i < collisionUUIDs.Count; i++)
{
OSD arg = collisionUUIDs[i];
UUID collidingUUID = arg.AsUUID();
SceneObjectPart obj = pRegionContext.Scene.GetSceneObjectPart(collidingUUID);
if (obj != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = obj.UUID;
detobj.nameStr = obj.Name;
detobj.ownerUUID = obj.OwnerID;
detobj.posVector = obj.AbsolutePosition;
detobj.rotQuat = obj.GetWorldRotation();
detobj.velVector = obj.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = obj.GroupID;
Colliders.Add(detobj);
}
else
{
//collision object is not a prim, check if it's an avatar
ScenePresence av = pRegionContext.Scene.GetScenePresence(collidingUUID);
if (av != null)
{
DetectedObject detobj = new DetectedObject();
detobj.keyUUID = av.UUID;
detobj.nameStr = av.ControllingClient.Name;
detobj.ownerUUID = av.UUID;
detobj.posVector = av.AbsolutePosition;
detobj.rotQuat = av.Rotation;
detobj.velVector = av.Velocity;
detobj.colliderType = 0;
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
Colliders.Add(detobj);
}
else
{
// m_log.WarnFormat("HandleRemoteEvent_ScriptCollidingStart for SOP {0},{1} with SOP/SP {2}, but the latter is not found in local Scene. Saved for later processing",
// collisionPart.Name, collisionPart.UUID, collidingUUID);
CollidersNotFound.Add(collidingUUID);
}
}
}
}