• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CollisionEventUpdate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CollisionEventUpdate的典型用法代码示例。如果您正苦于以下问题:C# CollisionEventUpdate类的具体用法?C# CollisionEventUpdate怎么用?C# CollisionEventUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CollisionEventUpdate类属于命名空间,在下文中一共展示了CollisionEventUpdate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: BSPhysObject

    protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
    {
        IsInitialized = false;

        PhysScene = parentScene;
        LocalID = localID;
        PhysObjectName = name;
        Name = name;    // PhysicsActor also has the name of the object. Someday consolidate.
        TypeName = typeName;

        // The collection of things that push me around
        PhysicalActors = new BSActorCollection(PhysScene);

        // Initialize variables kept in base.
        GravModifier = 1.0f;
        Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);
        HoverActive = false;

        // We don't have any physical representation yet.
        PhysBody = new BulletBody(localID);
        PhysShape = new BSShapeNull();

        UserSetCenterOfMassDisplacement = null;

        PrimAssetState = PrimAssetCondition.Unknown;

        // Default material type. Also sets Friction, Restitution and Density.
        SetMaterial((int)MaterialAttributes.Material.Wood);

        CollisionCollection = new CollisionEventUpdate();
        CollisionsLastReported = CollisionCollection;
        CollisionsLastTick = new CollisionEventUpdate();
        CollisionsLastTickStep = -1;

        SubscribedEventsMs = 0;
        // Crazy values that will never be true
        CollidingStep = BSScene.NotASimulationStep;
        CollidingGroundStep = BSScene.NotASimulationStep;
        CollisionAccumulation = BSScene.NotASimulationStep;
        ColliderIsMoving = false;
        CollisionScore = 0;

        // All axis free.
        LockedLinearAxis = LockedAxisFree;
        LockedAngularAxis = LockedAxisFree;
    }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:46,代码来源:BSPhysObject.cs


示例17: SendCollisions

        public void SendCollisions()
        {
            if (CollisionEventsThisFrame == null)
                return;

            base.SendCollisionUpdate(CollisionEventsThisFrame);

            if (CollisionEventsThisFrame.m_objCollisionList.Count == 0)
                CollisionEventsThisFrame = null;
            else
                CollisionEventsThisFrame = new CollisionEventUpdate();
        }
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:12,代码来源:AODEPrim.cs


示例18: Collide

    // I've collided with something
    public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
    {
        // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith);

        // The following lines make IsColliding() and IsCollidingGround() work
        _collidingStep = _scene.SimulationStep;
        if (collidingWith == BSScene.TERRAIN_ID || collidingWith == BSScene.GROUNDPLANE_ID)
        {
            _collidingGroundStep = _scene.SimulationStep;
        }

        if (_subscribedEventsMs == 0) return;   // nothing in the object is waiting for collision events
        // throttle the collisions to the number of milliseconds specified in the subscription
        int nowTime = _scene.SimulationNowTime;
        if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return;
        _lastCollisionTime = nowTime;

        // create the event for the collision
        Dictionary<uint, ContactPoint> contactPoints = new Dictionary<uint, ContactPoint>();
        contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
        CollisionEventUpdate args = new CollisionEventUpdate(contactPoints);
        base.SendCollisionUpdate(args);
    }
开发者ID:justasabc,项目名称:opensim,代码行数:24,代码来源:BSPrim.cs


示例19: HandleLandCollisionBegan

 private void HandleLandCollisionBegan(CollisionEventUpdate update)
 {
     HandleGenericLandCollisionEvent(update, Scenes.ScriptEvents.land_collision_start,
         m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart, true);
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:5,代码来源:SceneObjectPart.cs


示例20: BSPhysObject

    protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
    {
        PhysicsScene = parentScene;
        LocalID = localID;
        PhysObjectName = name;
        Name = name;    // PhysicsActor also has the name of the object. Someday consolidate.
        TypeName = typeName;

        // Initialize variables kept in base.
        GravModifier = 1.0f;
        Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);

        // We don't have any physical representation yet.
        PhysBody = new BulletBody(localID);
        PhysShape = new BulletShape();

        LastAssetBuildFailed = false;

        // Default material type. Also sets Friction, Restitution and Density.
        SetMaterial((int)MaterialAttributes.Material.Wood);

        CollisionCollection = new CollisionEventUpdate();
        CollisionsLastTick = CollisionCollection;
        SubscribedEventsMs = 0;
        CollidingStep = 0;
        CollidingGroundStep = 0;
        CollisionAccumulation = 0;
        ColliderIsMoving = false;
        CollisionScore = 0;

        // All axis free.
        LockedAxis = LockedAxisFree;
    }
开发者ID:rryk,项目名称:omp-server,代码行数:33,代码来源:BSPhysObject.cs



注:本文中的CollisionEventUpdate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CollisionFlags类代码示例发布时间:2022-05-24
下一篇:
C# CollisionCategories类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap