BOX2D 에 관 한 이야기 (2)
AddShape(b2ShapeDef* shape)。
        ,           ,            。
           HelloWorld         ,      CompoundShapes  。
   、CompoundShapes
  CompoundShapes          ,   HelloWorld  ,   ,            ,    b2Mat22          ,             。
          HelloWorld    ,      ,                  ,                 。
   、 VaryingRestitution、VaryingFriction、Pyramid、PolyShapes
  Box2D            ,                   ,          ,       ,Pyramid              ,     Make       。       。
  PolyShapes                 ,                  8   。
   、 CollisionFiltering、
                       ,      ,              ,Box2D    16     ,               ,                  ,            ,                ,            ,         ,     
  playerShapeDef.categoryBits = 0x0002;
  monsterShapeDef.categoryBits = 0x0004;
  playerShape.maskBits = 0x0004;
  monsterShapeDef.maskBits = 0x0002;
                         ,                ,          ,       ,         ,                  。
  shape1Def.groupIndex = 2;
  shape2Def.groupIndex = 2;
  shape3Def.groupIndex = -8;
  shape4Def.groupIndex = -8;
    1 2   ,       0, 3 4   ,    0
                   .
   、 ApplyForce
                    ,             ,                。
        ,                ,          。
             ,         ,           。                ,Box2D          。
             ,
  uint32 m_flags;
      :
  b2Vec2 m_position;
       :
  float32 m_rotation;
      :
  b2Vec2 m_linearVelocity;
     :
  float32 m_angularVelocity;
   :
  b2Vec2 m_force;
    :
  float32 m_torque;
     :
  b2Shape* m_shapeList;
     :
  int32 m_shapeCount;
     :
  b2JointNode* m_jointList;
     :
  b2ContactNode* m_contactList;
    :
  float32 m_mass, m_invMass;
  float32 m_I, m_invI;
      :
  float32 m_linearDamping;
     :
  float32 m_angularDamping;
      
  float32 m_sleepTime;
      :
  void* m_userData;
          :
  1、          
  void SetOriginPosition(const b2Vec2& position, float32 rotation);
  2、       
  b2Vec2 GetOriginPosition() const;
  3、             
  void SetCenterPosition(const b2Vec2& position, float32 rotation);
  4、         
  b2Vec2 GetCenterPosition() const;
  5、     
  float32 GetRotation() const;
  6、      
  const b2Mat22& GetRotationMatrix() const;
  7、            
  void SetLinearVelocity(const b2Vec2& v);
  b2Vec2 GetLinearVelocity() const;
  8、        
  void SetAngularVelocity(float32 w);
  float32 GetAngularVelocity() const;
  9、          
  void ApplyForce(const b2Vec2& force, const b2Vec2& point);
  force     ,point    
  10、      
  void ApplyTorque(float32 torque);
  11、         
  void ApplyImpulse(const b2Vec2& impulse, const b2Vec2& point);
  12、    
  float32 GetMass() const;
  13、    
  float32 GetInertia() const;
  14、     (                )
  b2Vec2 GetWorldPoint(const b2Vec2& localPoint);
  15、                    
  b2Vec2 GetWorldVector(const b2Vec2& localVector);
  16、                   
                이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
HDOJ/HDU 1113 Word Amalgamation (사전 순서 ~ 지도)a dictionary, which consists of at least one and at most 100 words, one per line; a line containing XXXXXX, which signal...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.