コード例 #1
0
ファイル: CollisionWorld.cs プロジェクト: Belxjander/Asuna
        public ClosestNotMeRayResultCallback() { } // for pool

        public ClosestNotMeRayResultCallback(IndexedVector3 rayFromWorld, IndexedVector3 rayToWorld,
                                                CollisionObject NotMeShape)
        {
            m_rayFromWorld = rayFromWorld;
            m_rayToWorld = rayToWorld;
            ObjectToAvoid = (uint) NotMeShape.GetUserPointer();
        }
コード例 #2
0
ファイル: BSAPIXNA.cs プロジェクト: CassieEllen/opensim
    private static void RecordCollision(BSAPIXNA world, CollisionObject objA, CollisionObject objB, IndexedVector3 contact, IndexedVector3 norm, float penetration)
    {

        IndexedVector3 contactNormal = norm;
        if ((objA.GetCollisionFlags() & BulletXNA.BulletCollision.CollisionFlags.BS_WANTS_COLLISIONS) == 0 &&
            (objB.GetCollisionFlags() & BulletXNA.BulletCollision.CollisionFlags.BS_WANTS_COLLISIONS) == 0)
        {
            return;
        }
        uint idA = (uint)objA.GetUserPointer();
        uint idB = (uint)objB.GetUserPointer();
        if (idA > idB)
        {
            uint temp = idA;
            idA = idB;
            idB = temp;
            contactNormal = -contactNormal;
        }

        //ulong collisionID = ((ulong) idA << 32) | idB;

        CollisionDesc cDesc = new CollisionDesc()
                                            {
                                                aID = idA,
                                                bID = idB,
                                                point = new Vector3(contact.X,contact.Y,contact.Z),
                                                normal = new Vector3(contactNormal.X,contactNormal.Y,contactNormal.Z),
                                                penetration = penetration

                                            };
        if (world.LastCollisionDesc < world.UpdatedCollisions.Length)
            world.UpdatedCollisions[world.LastCollisionDesc++] = (cDesc);
        m_collisionsThisFrame++;


    }
コード例 #3
0
ファイル: BSAPIXNA.cs プロジェクト: justasabc/opensim75grid
    private static void RecordCollision(CollisionWorld world, CollisionObject objA, CollisionObject objB, IndexedVector3 contact, IndexedVector3 norm)
    {
       
        IndexedVector3 contactNormal = norm;
        if ((objA.GetCollisionFlags() & BulletXNA.BulletCollision.CollisionFlags.BS_WANTS_COLLISIONS) == 0 &&
            (objB.GetCollisionFlags() & BulletXNA.BulletCollision.CollisionFlags.BS_WANTS_COLLISIONS) == 0)
        {
            return;
        }
        uint idA = (uint)objA.GetUserPointer();
        uint idB = (uint)objB.GetUserPointer();
        if (idA > idB)
        {
            uint temp = idA;
            idA = idB;
            idB = temp;
            contactNormal = -contactNormal;
        }

        ulong collisionID = ((ulong) idA << 32) | idB;

        BulletXNA.CollisionDesc cDesc = new BulletXNA.CollisionDesc()
                                            {
                                                aID = idA,
                                                bID = idB,
                                                point = contact,
                                                normal = contactNormal
                                            };
        world.UpdatedCollisions.Add(cDesc);
        m_collisionsThisFrame++;


    }