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

C# RaycastCallback类代码示例

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

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



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

示例1: QueueRequest

        /// <summary>
        /// Queues a raycast
        /// </summary>
        /// <param name="position">Origin of Ray</param>
        /// <param name="direction">Ray normal</param>
        /// <param name="length">Ray length</param>
        /// <param name="retMethod">Return method to send the results</param>
        public void QueueRequest(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
        {
            lock (m_PendingRequests)
            {
                ODERayCastRequest req = new ODERayCastRequest();
                req.callbackMethod = retMethod;
                req.length = length;
                req.Normal = direction;
                req.Origin = position;

                m_PendingRequests.Add(req);
            }
        }
开发者ID:Ideia-Boa,项目名称:diva-distribution,代码行数:20,代码来源:ODERayCastRequestManager.cs


示例2: Wheel

        /// <summary>
        /// Creates a new instance of the Wheel class.
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="car">The RigidBody on which to apply the wheel forces.</param>
        /// <param name="position">The position of the wheel on the body (in body space).</param>
        /// <param name="radius">The wheel radius.</param>
        public Wheel(World world,RigidBody car,JVector position,float radius)
        {
            this.world = world;
            this.car = car;
            this.Position = position;

            raycast = new RaycastCallback(RaycastCallback);

            // set some default values.
            this.SideFriction = 1.5f;
            this.ForwardFriction = 1f;
            this.Radius = radius;
            this.Inertia = 1.0f;
            this.WheelTravel = 0.2f;
            this.MaximumAngularVelocity = 200;
            this.NumberOfRays = 5;
        }
开发者ID:reidyd,项目名称:jitterphysics,代码行数:24,代码来源:Wheel.cs


示例3: Tool

        //Vector3 rawRotation;//, rotation;
        public Tool(Player parent, GameInput gameInput)
        {
            Parent = parent;

            this.gameInput = gameInput;

            raycastCallback = new RaycastCallback(mRaycastCallback);

            slot = getSlot();

            icon = new GuiElement(this.parent.hud);
            icon.setSizeRel(new Vector2(256, 128));

            iconPos = new Vector2(-0.8f, 0.8f - slot * iconDist);
            smoothIconPos = iconPos;
            icon.Position = smoothIconPos;

            icon.setMaterial("hud\\blank_icon.xmf");

            createWeaponModel();
        }
开发者ID:Richy19,项目名称:ultraSandbox,代码行数:22,代码来源:Tool.cs


示例4: RaycastWorld

 /// <summary>
 /// Queue a raycast against the physics scene.
 /// The provided callback method will be called when the raycast is complete
 /// 
 /// Many physics engines don't support collision testing at the same time as 
 /// manipulating the physics scene, so we queue the request up and callback 
 /// a custom method when the raycast is complete.
 /// This allows physics engines that give an immediate result to callback immediately
 /// and ones that don't, to callback when it gets a result back.
 /// 
 /// ODE for example will not allow you to change the scene while collision testing or
 /// it asserts, 'opteration not valid for locked space'.  This includes adding a ray to the scene.
 /// 
 /// This is named RayCastWorld to not conflict with modrex's Raycast method.
 /// </summary>
 /// <param name="position">Origin of the ray</param>
 /// <param name="direction">Direction of the ray</param>
 /// <param name="length">Length of ray in meters</param>
 /// <param name="retMethod">Method to call when the raycast is complete</param>
 public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
 {
     if (retMethod != null)
         retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero);
 }
开发者ID:Gitlab11,项目名称:opensim,代码行数:24,代码来源:PhysicsScene.cs


示例5: Raycast

        public override bool Raycast(JVector rayOrigin, JVector rayDirection, RaycastCallback raycast, out RigidBody body, out JVector normal, out float fraction)
        {
            throw new NotImplementedException();
            //body = null; normal = JVector.Zero; fraction = float.MaxValue;

            //JVector tempNormal; float tempFraction;
            //bool result = false;

            //// TODO: This can be done better in CollisionSystemPersistenSAP
            //foreach (IBroadphaseEntity e in bodyList)
            //{
            //    if (e is SoftBody)
            //    {
            //        SoftBody softBody = e as SoftBody;
            //        foreach (RigidBody b in softBody.VertexBodies)
            //        {
            //            if (this.Raycast(b, rayOrigin, rayDirection, out tempNormal, out tempFraction))
            //            {
            //                if (tempFraction < fraction && (raycast == null || raycast(b, tempNormal, tempFraction)))
            //                {
            //                    body = b;
            //                    normal = tempNormal;
            //                    fraction = tempFraction;
            //                    result = true;
            //                }
            //            }
            //        }
            //    }
            //    else
            //    {
            //        RigidBody b = e as RigidBody;

            //        if (this.Raycast(b, rayOrigin, rayDirection, out tempNormal, out tempFraction))
            //        {
            //            if (tempFraction < fraction && (raycast == null || raycast(b, tempNormal, tempFraction)))
            //            {
            //                body = b;
            //                normal = tempNormal;
            //                fraction = tempFraction;
            //                result = true;
            //            }
            //        }
            //    }
            //}

            //return result;
        }
开发者ID:reidyd,项目名称:jitterphysics,代码行数:47,代码来源:CollisionSystemPersistentSAP.cs


示例6: RaycastWorld

 public override void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
 {
     if (retMethod != null)
     {
         m_rayCastManager.QueueRequest(position, direction, length, retMethod);
     }
 }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:7,代码来源:ODEPhysicsScene.cs


示例7: Raycast

 /// <summary>
 /// Sends a ray (definied by start and direction) through the scene (all bodies added).
 /// NOTE: For performance reasons terrain and trianglemeshshape aren't checked
 /// against rays (rays are of infinite length). They are checked against segments
 /// which start at rayOrigin and end in rayOrigin + rayDirection.
 /// </summary>
 public abstract bool Raycast(JVector rayOrigin, JVector rayDirection, RaycastCallback raycast, out RigidBody body, out JVector normal,out float fraction);
开发者ID:onefiftyone,项目名称:jitterphysics,代码行数:7,代码来源:CollisionSystem.cs


示例8: Raycast

        public override bool Raycast(JVector rayOrigin, JVector rayDirection, RaycastCallback raycast, out RigidBody body, out JVector normal, out double fraction)
        {
            body = null; normal = JVector.Zero; fraction = double.MaxValue;

            JVector tempNormal; double tempFraction;
            bool result = false;

            // TODO: This can be done better in CollisionSystemPersistenSAP
            foreach (IBroadphaseEntity e in bodyList)
            {
                if (e is SoftBody)
                {
                    SoftBody softBody = e as SoftBody;
                    foreach (RigidBody b in softBody.VertexBodies)
                    {
                        if (this.Raycast(b, rayOrigin, rayDirection, out tempNormal, out tempFraction))
                        {
                            if (tempFraction < fraction && (raycast == null || raycast(b, tempNormal, tempFraction)))
                            {
                                body = b;
                                normal = tempNormal;
                                fraction = tempFraction;
                                result = true;
                            }
                        }
                    }
                }
                else
                {
                    RigidBody b = e as RigidBody;

                    if (this.Raycast(b, rayOrigin, rayDirection, out tempNormal, out tempFraction))
                    {
                        if (tempFraction < fraction && (raycast == null || raycast(b, tempNormal, tempFraction)))
                        {
                            body = b;
                            normal = tempNormal;
                            fraction = tempFraction;
                            result = true;
                        }
                    }
                }
            }

            return result;
        }
开发者ID:MagistrAVSH,项目名称:my-spacegame-engine,代码行数:46,代码来源:CollisionSystemBrute.cs


示例9: RaycastActor

 public override void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
 {
     if (retMethod != null && actor !=null)
     {
         IntPtr geom;
         if (actor is OdePrim)
             geom = ((OdePrim)actor).prim_geom;
         else if (actor is OdeCharacter)
             geom = ((OdePrim)actor).prim_geom;
         else
             return;
         if (geom == IntPtr.Zero)
             return;
         m_rayCastManager.QueueRequest(geom, position, direction, length, retMethod);
     }
 }
开发者ID:UbitUmarov,项目名称:Ubit-opensim,代码行数:16,代码来源:OdeScene.cs


示例10: QueueRequest

        public void QueueRequest(IntPtr geom, Vector3 position, Vector3 direction, float length, int count, RaycastCallback retMethod)
        {
            ODERayRequest req = new ODERayRequest();
            req.geom = geom;
            req.callbackMethod = retMethod;
            req.length = length;
            req.Normal = direction;
            req.Origin = position;
            req.Count = count;

            m_PendingRequests.Enqueue(req);
        }
开发者ID:JamesStallings,项目名称:Ubit-opensim,代码行数:12,代码来源:ODERayCastRequestManager.cs


示例11: getFocus

 public float getFocus()
 {
     RaycastCallback raycast = new RaycastCallback(RaycastCallback); RigidBody body; JVector normal; float frac;
     bool result = Scene.world.CollisionSystem.Raycast(GenericMethods.FromOpenTKVector(Position), GenericMethods.FromOpenTKVector(PointingDirection),
         raycast, out body, out normal, out frac);
     if (result)
     {
         return frac;
     }
     else
     {
         return zFar;
     }
 }
开发者ID:Metapyziks,项目名称:ultraSandbox,代码行数:14,代码来源:ViewInfo.cs


示例12: RaycastWorld

        public override void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
        {
            if (retMethod != null)
            {
                ODERayRequest req = new ODERayRequest();
                req.actor = null;
                req.callbackMethod = retMethod;
                req.length = length;
                req.Normal = direction;
                req.Origin = position;
                req.Count = 0;
                req.filter = RayFilterFlags.AllPrims;

                m_rayCastManager.QueueRequest(req);
            }
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:16,代码来源:ODEScene.cs


示例13: Raycast

        public bool Raycast(Vector3 origin, Vector3 direction, RaycastCallback callback, out Body body, out Vector3 normal, out float fraction)
        {
            RigidBody rigidBody;
            JVector jitterNormal;

            Jitter.Collision.RaycastCallback jitterCallback = (RigidBody body1, JVector normal1, float fraction1) =>
            {
                return callback((Body)body1.Tag, Conversion.ToTritonVector(ref normal1), fraction1);
            };

            var res = PhysicsWorld.CollisionSystem.Raycast(Conversion.ToJitterVector(ref origin), Conversion.ToJitterVector(ref direction), jitterCallback, out rigidBody, out jitterNormal, out fraction);

            normal = Conversion.ToTritonVector(ref jitterNormal);
            if (rigidBody != null)
            {
                body = (Body)rigidBody.Tag;
            }
            else
            {
                body = null;
            }

            return res;
        }
开发者ID:johang88,项目名称:triton,代码行数:24,代码来源:World.cs


示例14: Raycast

 public override bool Raycast(JVector rayOrigin, JVector rayDirection, RaycastCallback raycast, out RigidBody body, out JVector normal, out float fraction)
 {
     throw new NotImplementedException();
 }
开发者ID:reidyd,项目名称:jitterphysics,代码行数:4,代码来源:CollisionSystemDynamicTree.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# RazorEngineHost类代码示例发布时间:2022-05-24
下一篇:
C# RayCastInput类代码示例发布时间: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