Ejemplo n.º 1
0
 protected void UpdateSensor()
 {
     if (m_fixture != null)
     {
         PhysicsSystem physicsSystem = m_gameObject.Scene.GetPhysicsSystem();
         m_body.DestroyFixture(m_fixture);
     }
     m_fixture          = CreateSensor();
     m_fixture.IsSensor = true;
     FixtureCollisionCategroy.SetCollsionCategroy(m_fixture, (FixtureCollisionCategroy.Kind)(m_collisionCategroy.GetValue()));
     m_fixture.OnCollision  += OnCollision;
     m_fixture.OnSeparation += OnSeparation;
 }
Ejemplo n.º 2
0
        protected void UpdateSensor()
        {
            PhysicsSystem physicsSystem = m_gameObject.Scene.GetPhysicsSystem();

            if (physicsSystem == null)
            {
                return;
            }
            if (m_body != null)
            {
                physicsSystem.GetWorld().RemoveBody(m_body);
                m_body = null;
            }
            m_body = BodyFactory.CreateCircle(physicsSystem.GetWorld(), m_radius,
                                              0.1f, new Tag(3, 0.0f, m_gameObject));
            FixtureCollisionCategroy.SetCollsionCategroy(m_body, FixtureCollisionCategroy.Kind.RoleSensor);
            m_body.BodyType       = BodyType.Static;
            m_body.IsSensor       = true;
            m_body.CollisionGroup = -1;
            m_body.OnCollision   += OnCollision;
            m_debugShape.SetAsCircle(m_radius, m_offset);
        }
Ejemplo n.º 3
0
 protected void UpdateCollisionCategroy()
 {
     FixtureCollisionCategroy.SetCollsionCategroy(
         m_body, (FixtureCollisionCategroy.Kind)(m_collisionCategroy.GetValue()));
 }