當前位置: 首頁>>代碼示例>>C#>>正文


C# CollisionEventUpdate類代碼示例

本文整理匯總了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;
    }
開發者ID:MAReantals,項目名稱:opensim,代碼行數:14,代碼來源:BSPhysObject.cs

示例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;
    }
開發者ID:justasabc,項目名稱:opensim75grid,代碼行數:18,代碼來源:BSPhysObject.cs

示例3: SubscribeEvents

 public override void SubscribeEvents(int ms)
 {
     m_eventsubscription = ms;
     m_cureventsubscription = 0;
     if (CollisionEventsThisFrame == null)
         CollisionEventsThisFrame = new CollisionEventUpdate();
     SentEmptyCollisionsEvent = false;
 }
開發者ID:CassieEllen,項目名稱:opensim,代碼行數:8,代碼來源:ODECharacter.cs

示例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 ();
 }
開發者ID:LOG123,項目名稱:Aurora-Sim-PhysX,代碼行數:10,代碼來源:PhysX.cs

示例5: HandleBulkCollisionsContinue

 private void HandleBulkCollisionsContinue(CollisionEventUpdate update)
 {
     HandleGenericCollisionEvent(update, Scenes.ScriptEvents.collision, m_parentGroup.Scene.EventManager.TriggerScriptColliding, false);
 }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:4,代碼來源:SceneObjectPart.cs

示例6: SendCollisions

 public void SendCollisions()
 {
     if (m_eventsubscription >= m_requestedUpdateFrequency)
     {
         if (CollisionEventsThisFrame != null)
         {
             base.SendCollisionUpdate(CollisionEventsThisFrame);
         }
         CollisionEventsThisFrame = new CollisionEventUpdate();
         m_eventsubscription = 0;
     }
     return;
 }
開發者ID:NickyPerian,項目名稱:Aurora,代碼行數:13,代碼來源:BulletDotNETCharacter.cs

示例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);
        }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:19,代碼來源:SceneObjectPart.cs

示例8: HandleCollisionBegan

 private void HandleCollisionBegan(CollisionEventUpdate update)
 {
     this.HandleGenericCollisionEvent(update, Scenes.ScriptEvents.collision_start, m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart, true);
 }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:4,代碼來源:SceneObjectPart.cs

示例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;
    }
開發者ID:BogusCurry,項目名稱:arribasim-dev,代碼行數:44,代碼來源:BSPhysObject.cs

示例10: HandleLandCollisionEnded

 private void HandleLandCollisionEnded(CollisionEventUpdate update)
 {
     HandleGenericLandCollisionEvent(update, Scenes.ScriptEvents.land_collision_end,
         m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd, false);
 }
開發者ID:kf6kjg,項目名稱:halcyon,代碼行數:5,代碼來源:SceneObjectPart.cs

示例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;
    }
開發者ID:MAReantals,項目名稱:opensim,代碼行數:34,代碼來源:BSPhysObject.cs

示例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);
                }
            }
        }
開發者ID:digitalmystic,項目名稱:halcyon,代碼行數:43,代碼來源:PhysxPrim.cs

示例13: SendCollisions

 public void SendCollisions()
 {
     if (m_eventsubscription > 0)
     {
         base.SendCollisionUpdate(CollisionEventsThisFrame);
         CollisionEventsThisFrame = new CollisionEventUpdate();
     }
 }
開發者ID:Ideia-Boa,項目名稱:diva-distribution,代碼行數:8,代碼來源:ODECharacter.cs

示例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);
     }
 }
開發者ID:CassieEllen,項目名稱:opensim,代碼行數:10,代碼來源:ODECharacter.cs

示例15: AddCollisionEvent

 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
 {
     if (CollisionEventsThisFrame == null)
         CollisionEventsThisFrame = new CollisionEventUpdate();
     CollisionEventsThisFrame.addCollider(CollidedWith, contact);
 }
開發者ID:rknop,項目名稱:Aurora-Sim,代碼行數:6,代碼來源:AODEPrim.cs


注:本文中的CollisionEventUpdate類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。