本文整理汇总了C#中CollisionEventUpdate类的典型用法代码示例。如果您正苦于以下问题:C# CollisionEventUpdate类的具体用法?C# CollisionEventUpdate怎么用?C# CollisionEventUpdate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CollisionEventUpdate类属于命名空间,在下文中一共展示了CollisionEventUpdate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseInitialize
protected void BaseInitialize(BSScene parentScene, uint localID, string name, string typeName)
{
PhysicsScene = parentScene;
LocalID = localID;
PhysObjectName = name;
TypeName = typeName;
Linkset = new BSLinkset(PhysicsScene, this);
CollisionCollection = new CollisionEventUpdate();
SubscribedEventsMs = 0;
CollidingStep = 0;
CollidingGroundStep = 0;
}
示例2: BSPhysObject
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
{
PhysicsScene = parentScene;
LocalID = localID;
PhysObjectName = name;
TypeName = typeName;
Linkset = BSLinkset.Factory(PhysicsScene, this);
LastAssetBuildFailed = false;
// Default material type
Material = MaterialAttributes.Material.Wood;
CollisionCollection = new CollisionEventUpdate();
SubscribedEventsMs = 0;
CollidingStep = 0;
CollidingGroundStep = 0;
}
示例3: SubscribeEvents
public override void SubscribeEvents(int ms)
{
m_eventsubscription = ms;
m_cureventsubscription = 0;
if (CollisionEventsThisFrame == null)
CollisionEventsThisFrame = new CollisionEventUpdate();
SentEmptyCollisionsEvent = false;
}
示例4: SendCollisions
public override void SendCollisions ()
{
if (CollisionEventsThisFrame == null || m_frozen)//No collisions or frozen, don't mess with it
return;
base.SendCollisionUpdate (CollisionEventsThisFrame);
if (CollisionEventsThisFrame.m_objCollisionList.Count == 0)
CollisionEventsThisFrame = null;
else
CollisionEventsThisFrame = new CollisionEventUpdate ();
}
示例5: HandleBulkCollisionsContinue
private void HandleBulkCollisionsContinue(CollisionEventUpdate update)
{
HandleGenericCollisionEvent(update, Scenes.ScriptEvents.collision, m_parentGroup.Scene.EventManager.TriggerScriptColliding, false);
}
示例6: SendCollisions
public void SendCollisions()
{
if (m_eventsubscription >= m_requestedUpdateFrequency)
{
if (CollisionEventsThisFrame != null)
{
base.SendCollisionUpdate(CollisionEventsThisFrame);
}
CollisionEventsThisFrame = new CollisionEventUpdate();
m_eventsubscription = 0;
}
return;
}
示例7: HandleGenericLandCollisionEvent
private void HandleGenericLandCollisionEvent(CollisionEventUpdate update, Scenes.ScriptEvents eventType,
EventManager.ScriptLandColliding callback, bool playSound)
{
// play the sound.
if (playSound && CollisionSound != UUID.Zero && eventType == ScriptEvents.collision_start && CollisionSoundVolume > 0.0f)
{
SendSound(CollisionSound, CollisionSoundVolume, (byte)SoundFlags.None, true);
}
SceneObjectPart handlingPart = FindCollisionHandlingPart(eventType);
if (handlingPart == null) return; //no one to handle the event
if (m_parentGroup == null)
return;
if (m_parentGroup.Scene == null)
return;
callback(handlingPart.LocalId, update.CollisionLocation);
}
示例8: HandleCollisionBegan
private void HandleCollisionBegan(CollisionEventUpdate update)
{
this.HandleGenericCollisionEvent(update, Scenes.ScriptEvents.collision_start, m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart, true);
}
示例9: Collide
public virtual bool Collide(uint collidingWith, BSPhysObject collidee,
OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
{
bool ret = false;
// The following lines make IsColliding(), CollidingGround() and CollidingObj work
CollidingStep = PhysScene.SimulationStep;
if (collidingWith <= PhysScene.TerrainManager.HighestTerrainID)
{
CollidingGroundStep = PhysScene.SimulationStep;
}
else
{
CollidingObjectStep = PhysScene.SimulationStep;
}
CollisionAccumulation++;
// For movement tests, remember if we are colliding with an object that is moving.
ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false;
ColliderIsVolumeDetect = collidee != null ? (collidee.IsVolumeDetect) : false;
// Make a collection of the collisions that happened the last simulation tick.
// This is different than the collection created for sending up to the simulator as it is cleared every tick.
if (CollisionsLastTickStep != PhysScene.SimulationStep)
{
CollisionsLastTick = new CollisionEventUpdate();
CollisionsLastTickStep = PhysScene.SimulationStep;
}
CollisionsLastTick.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
// If someone has subscribed for collision events log the collision so it will be reported up
if (SubscribedEvents()) {
lock (PhysScene.CollisionLock)
{
CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
}
DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
ret = true;
}
return ret;
}
示例10: HandleLandCollisionEnded
private void HandleLandCollisionEnded(CollisionEventUpdate update)
{
HandleGenericLandCollisionEvent(update, Scenes.ScriptEvents.land_collision_end,
m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd, false);
}
示例11: SendCollisions
// Routine to send the collected collisions into the simulator.
// Also handles removal of this from the collection of objects with collisions if
// there are no collisions from this object. Mechanism is create one last
// collision event to make collision_end work.
// Called at taint time from within the Step() function thus no locking problems
// with CollisionCollection and ObjectsWithNoMoreCollisions.
// Return 'true' if there were some actual collisions passed up
public virtual bool SendCollisions()
{
bool ret = true;
// throttle the collisions to the number of milliseconds specified in the subscription
int nowTime = PhysicsScene.SimulationNowTime;
if (nowTime >= NextCollisionOkTime)
{
NextCollisionOkTime = nowTime + SubscribedEventsMs;
// We are called if we previously had collisions. If there are no collisions
// this time, send up one last empty event so OpenSim can sense collision end.
if (CollisionCollection.Count == 0)
{
// If I have no collisions this time, remove me from the list of objects with collisions.
ret = false;
}
// DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName, CollisionCollection.Count);
base.SendCollisionUpdate(CollisionCollection);
// The collisionCollection structure is passed around in the simulator.
// Make sure we don't have a handle to that one and that a new one is used for next time.
CollisionCollection = new CollisionEventUpdate();
}
return ret;
}
示例12: ReportContinuingCollisions
private void ReportContinuingCollisions()
{
if (_touchCounts.IsValueCreated && _touchCounts.Value.Count > 0)
{
List<uint> continuingList = new List<uint>(_touchCounts.Value.Count);
foreach (PhysxPrim prim in _touchCounts.Value.Keys)
{
if (this.GroupVelocity != OpenMetaverse.Vector3.Zero || prim._velocity != OpenMetaverse.Vector3.Zero)
{
continuingList.Add(prim._localId);
}
}
if (continuingList.Count > 0)
{
CollisionEventUpdate upd = new CollisionEventUpdate { Type = CollisionEventUpdateType.BulkCollisionsContinue, BulkCollisionData = continuingList };
SendCollisionUpdate(upd);
}
}
if (_groundTouchCounts > 0 && this.GroupVelocity != OpenMetaverse.Vector3.Zero)
{
OpenMetaverse.Vector3 currentLoc = DecomposeGroupPosition();
SendCollisionUpdate(new CollisionEventUpdate { Type = CollisionEventUpdateType.LandCollisionContinues,
CollisionLocation = currentLoc});
}
if (_avatarTouchCounts.IsValueCreated && _avatarTouchCounts.Value.Count > 0)
{
List<uint> continuingList = new List<uint>(_avatarTouchCounts.Value.Count);
foreach (PhysxCharacter avatar in _avatarTouchCounts.Value.Keys)
{
continuingList.Add(avatar.LocalID);
}
if (continuingList.Count > 0)
{
CollisionEventUpdate upd = new CollisionEventUpdate { Type = CollisionEventUpdateType.BulkAvatarCollisionsContinue, BulkCollisionData = continuingList };
SendCollisionUpdate(upd);
}
}
}
示例13: SendCollisions
public void SendCollisions()
{
if (m_eventsubscription > 0)
{
base.SendCollisionUpdate(CollisionEventsThisFrame);
CollisionEventsThisFrame = new CollisionEventUpdate();
}
}
示例14: AddCollisionEvent
public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
{
if (CollisionEventsThisFrame == null)
CollisionEventsThisFrame = new CollisionEventUpdate();
lock (CollisionEventsThisFrame)
{
CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
_parent_scene.AddCollisionEventReporting(this);
}
}
示例15: AddCollisionEvent
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
{
if (CollisionEventsThisFrame == null)
CollisionEventsThisFrame = new CollisionEventUpdate();
CollisionEventsThisFrame.addCollider(CollidedWith, contact);
}