Universe.Physics.BulletSPlugin.BulletBody.ApplyCollisionMask C# (CSharp) Method

ApplyCollisionMask() public method

public ApplyCollisionMask ( BSScene physicsScene ) : bool
physicsScene BSScene
return bool
        public virtual bool ApplyCollisionMask(BSScene physicsScene)
        {
            // Should assert the body has been added to the physical world.
            // (The collision masks are stored in the collision proxy cache which only exists for
            //    a collision body that is in the world.)
            return physicsScene.PE.SetCollisionGroupMask(this,
                BulletSimData.CollisionTypeMasks[collisionType].group,
                BulletSimData.CollisionTypeMasks[collisionType].mask);
        }

Usage Example

コード例 #1
0
        // Create the initial instance of terrain and the underlying ground plane.
        // This is called from the initialization routine so we presume it is
        //    safe to call Bullet in real time. We hope no one is moving prims around yet.
        public void CreateInitialGroundPlaneAndTerrain()
        {
            DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero,
                      PhysicsScene.RegionName);
            // The ground plane is here to catch things that are trying to drop to negative infinity
            BulletShape groundPlaneShape = PhysicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f,
                                                                                  BSParam.TerrainCollisionMargin);
            Vector3 groundPlaneAltitude = new Vector3(0f, 0f, BSParam.TerrainGroundPlane);

            m_groundPlane = PhysicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
                                                                             BSScene.GROUNDPLANE_ID, groundPlaneAltitude, Quaternion.Identity);

            PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_groundPlane);
            PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_groundPlane);
            // Ground plane does not move
            PhysicsScene.PE.ForceActivationState(m_groundPlane, ActivationState.DISABLE_SIMULATION);
            // Everything collides with the ground plane.
            m_groundPlane.collisionType = CollisionType.Groundplane;
            m_groundPlane.ApplyCollisionMask(PhysicsScene);

            m_terrain = new BSTerrainHeightmap(PhysicsScene, Vector3.Zero, BSScene.TERRAIN_ID, m_worldMax);
        }
All Usage Examples Of Universe.Physics.BulletSPlugin.BulletBody::ApplyCollisionMask