示例#1
0
        public static void rayTestSingle(VInt3 fromPos, VInt3 toPos, CollisionObject collisionObject, RayResultCallback resultCallback)
        {
            SphereShape sphereShape    = (SphereShape)collisionObject.getCollisionShape();
            VInt3       objectPosition = collisionObject.getWorldTransform().position;
            VInt3       hitNormal      = VInt3.zero;
            VFixedPoint t0             = VFixedPoint.Zero;

            if (rayTestSphere(fromPos, toPos, objectPosition, sphereShape.getRadius(), ref hitNormal, ref t0))
            {
                resultCallback.addSingleResult(collisionObject, hitNormal.Normalize(), t0);
            }
        }
示例#2
0
        public static void rayTestSingle(VInt3 fromPos, VInt3 toPos, CollisionObject collisionObject, RayResultCallback resultCallback)
        {
            VIntTransform collisionObjectTransform = collisionObject.getWorldTransform();

            VFixedPoint t = VFixedPoint.Zero;
            VInt3       normal = VInt3.zero;
            VInt3       aabbMin, aabbMax;

            collisionObject.getCollisionShape().getAabb(VIntTransform.Identity, out aabbMin, out aabbMax);
            if (rayTestBox(fromPos, toPos, aabbMax, collisionObject.getWorldTransform(), ref t, ref normal))
            {
                resultCallback.addSingleResult(collisionObject, normal, t);
            }
        }
示例#3
0
        public static void rayTestSingle(VInt3 fromPos, VInt3 toPos, CollisionObject collisionObject, RayResultCallback resultCallback)
        {
            CapsuleShape capsule = (CapsuleShape)collisionObject.getCollisionShape();
            VInt3        p0      = collisionObject.getWorldTransform().TransformPoint(capsule.getUpAxis() * capsule.getHalfHeight());
            VInt3        p1      = collisionObject.getWorldTransform().TransformPoint(capsule.getUpAxis() * -capsule.getHalfHeight());

            VInt3 normal = VInt3.zero; VFixedPoint t = VFixedPoint.Zero;

            if (raycastCapsule(fromPos, toPos, p0, p1, capsule.getRadius(), ref normal, ref t))
            {
                resultCallback.addSingleResult(collisionObject, normal, t);
            }
        }
示例#4
0
 public SingleRayCallback(VInt3 rayFromWorld, VInt3 rayToWorld, Dispatcher dispatcher, RayResultCallback resultCallback) : base(rayFromWorld, rayToWorld)
 {
     this.dispatcher  = dispatcher;
     m_resultCallback = resultCallback;
 }
示例#5
0
        public void rayTest(VInt3 rayFromWorld, VInt3 rayToWorld, RayResultCallback resultCallback, short collisionFilterMask = CollisionFilterGroups.ALL_FILTER, short collisionFilterGroup = CollisionFilterGroups.ALL_FILTER)
        {
            SingleRayCallback rayCB = new SingleRayCallback(rayFromWorld, rayToWorld, dispatcher1, resultCallback);

            broadphase.rayTest(rayCB, dispatcher1, VInt3.zero, VInt3.zero, collisionFilterGroup, collisionFilterMask);
        }
示例#6
0
 public static void rayTestSingle(VInt3 fromPos, VInt3 toPos, CollisionObject collisionObject, RayResultCallback resultCallback)
 {
 }