home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / pup_idol.swf / scripts / Box2D / Dynamics / Contacts / b2PolyAndCircleContact.as < prev    next >
Encoding:
Text File  |  2008-08-07  |  1.5 KB  |  54 lines

  1. package Box2D.Dynamics.Contacts
  2. {
  3.    import Box2D.Collision.*;
  4.    import Box2D.Collision.Shapes.*;
  5.    import Box2D.Common.*;
  6.    import Box2D.Common.Math.*;
  7.    import Box2D.Dynamics.*;
  8.    
  9.    public class b2PolyAndCircleContact extends b2Contact
  10.    {
  11.        
  12.       
  13.       public var m_manifold:Array;
  14.       
  15.       public function b2PolyAndCircleContact(param1:b2Shape, param2:b2Shape)
  16.       {
  17.          m_manifold = [new b2Manifold()];
  18.          super(param1,param2);
  19.          b2Settings.b2Assert(m_shape1.m_type == b2Shape.e_polyShape);
  20.          b2Settings.b2Assert(m_shape2.m_type == b2Shape.e_circleShape);
  21.          m_manifold[0].pointCount = 0;
  22.          m_manifold[0].points[0].normalImpulse = 0;
  23.          m_manifold[0].points[0].tangentImpulse = 0;
  24.       }
  25.       
  26.       public static function Destroy(param1:b2Contact, param2:*) : void
  27.       {
  28.       }
  29.       
  30.       public static function Create(param1:b2Shape, param2:b2Shape, param3:*) : b2Contact
  31.       {
  32.          return new b2PolyAndCircleContact(param1,param2);
  33.       }
  34.       
  35.       override public function Evaluate() : void
  36.       {
  37.          b2Collision.b2CollidePolyAndCircle(m_manifold[0],m_shape1 as b2PolyShape,m_shape2 as b2CircleShape,false);
  38.          if(m_manifold[0].pointCount > 0)
  39.          {
  40.             m_manifoldCount = 1;
  41.          }
  42.          else
  43.          {
  44.             m_manifoldCount = 0;
  45.          }
  46.       }
  47.       
  48.       override public function GetManifolds() : Array
  49.       {
  50.          return m_manifold;
  51.       }
  52.    }
  53. }
  54.