home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / Beez.swf / scripts / Box2D / Dynamics / Joints / b2Joint.as < prev    next >
Encoding:
Text File  |  2008-09-03  |  4.1 KB  |  168 lines

  1. package Box2D.Dynamics.Joints
  2. {
  3.    import Box2D.Common.Math.b2Vec2;
  4.    import Box2D.Dynamics.b2Body;
  5.    import Box2D.Dynamics.b2TimeStep;
  6.    
  7.    public class b2Joint
  8.    {
  9.       
  10.       public static const e_unknownJoint:int = 0;
  11.       
  12.       public static const e_inactiveLimit:int = 0;
  13.       
  14.       public static const e_atUpperLimit:int = 2;
  15.       
  16.       public static const e_atLowerLimit:int = 1;
  17.       
  18.       public static const e_gearJoint:int = 6;
  19.       
  20.       public static const e_revoluteJoint:int = 1;
  21.       
  22.       public static const e_equalLimits:int = 3;
  23.       
  24.       public static const e_distanceJoint:int = 3;
  25.       
  26.       public static const e_pulleyJoint:int = 4;
  27.       
  28.       public static const e_prismaticJoint:int = 2;
  29.       
  30.       public static const e_mouseJoint:int = 5;
  31.        
  32.       
  33.       public var m_islandFlag:Boolean;
  34.       
  35.       public var m_body1:b2Body;
  36.       
  37.       public var m_prev:b2Joint;
  38.       
  39.       public var m_next:b2Joint;
  40.       
  41.       public var m_type:int;
  42.       
  43.       public var m_collideConnected:Boolean;
  44.       
  45.       public var m_node1:b2JointEdge;
  46.       
  47.       public var m_node2:b2JointEdge;
  48.       
  49.       public var m_inv_dt:Number;
  50.       
  51.       public var m_userData:*;
  52.       
  53.       public var m_body2:b2Body;
  54.       
  55.       public function b2Joint(def:b2JointDef)
  56.       {
  57.          m_node1 = new b2JointEdge();
  58.          m_node2 = new b2JointEdge();
  59.          super();
  60.          m_type = def.type;
  61.          m_prev = null;
  62.          m_next = null;
  63.          m_body1 = def.body1;
  64.          m_body2 = def.body2;
  65.          m_collideConnected = def.collideConnected;
  66.          m_islandFlag = false;
  67.          m_userData = def.userData;
  68.       }
  69.       
  70.       public static function Destroy(joint:b2Joint, allocator:*) : void
  71.       {
  72.       }
  73.       
  74.       public static function Create(def:b2JointDef, allocator:*) : b2Joint
  75.       {
  76.          var joint:b2Joint = null;
  77.          switch(def.type)
  78.          {
  79.             case e_distanceJoint:
  80.                joint = new b2DistanceJoint(def as b2DistanceJointDef);
  81.                break;
  82.             case e_mouseJoint:
  83.                joint = new b2MouseJoint(def as b2MouseJointDef);
  84.                break;
  85.             case e_prismaticJoint:
  86.                joint = new b2PrismaticJoint(def as b2PrismaticJointDef);
  87.                break;
  88.             case e_revoluteJoint:
  89.                joint = new b2RevoluteJoint(def as b2RevoluteJointDef);
  90.                break;
  91.             case e_pulleyJoint:
  92.                joint = new b2PulleyJoint(def as b2PulleyJointDef);
  93.                break;
  94.             case e_gearJoint:
  95.                joint = new b2GearJoint(def as b2GearJointDef);
  96.          }
  97.          return joint;
  98.       }
  99.       
  100.       public function GetBody2() : b2Body
  101.       {
  102.          return m_body2;
  103.       }
  104.       
  105.       public function GetAnchor1() : b2Vec2
  106.       {
  107.          return null;
  108.       }
  109.       
  110.       public function GetAnchor2() : b2Vec2
  111.       {
  112.          return null;
  113.       }
  114.       
  115.       public function GetNext() : b2Joint
  116.       {
  117.          return m_next;
  118.       }
  119.       
  120.       public function GetType() : int
  121.       {
  122.          return m_type;
  123.       }
  124.       
  125.       public function InitVelocityConstraints(step:b2TimeStep) : void
  126.       {
  127.       }
  128.       
  129.       public function GetReactionTorque() : Number
  130.       {
  131.          return 0;
  132.       }
  133.       
  134.       public function GetUserData() : *
  135.       {
  136.          return m_userData;
  137.       }
  138.       
  139.       public function GetReactionForce() : b2Vec2
  140.       {
  141.          return null;
  142.       }
  143.       
  144.       public function SolvePositionConstraints() : Boolean
  145.       {
  146.          return false;
  147.       }
  148.       
  149.       public function SetUserData(data:*) : void
  150.       {
  151.          m_userData = data;
  152.       }
  153.       
  154.       public function GetBody1() : b2Body
  155.       {
  156.          return m_body1;
  157.       }
  158.       
  159.       public function SolveVelocityConstraints(step:b2TimeStep) : void
  160.       {
  161.       }
  162.       
  163.       public function InitPositionConstraints() : void
  164.       {
  165.       }
  166.    }
  167. }
  168.