Box2D  2.3.0
A 2D Physics Engine for Games
b2Body.h
1 /*
2 * Copyright (c) 2006-2011 Erin Catto http://www.box2d.org
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 * 3. This notice may not be removed or altered from any source distribution.
17 */
18 
19 #ifndef B2_BODY_H
20 #define B2_BODY_H
21 
22 #include <Box2D/Common/b2Math.h>
23 #include <Box2D/Collision/Shapes/b2Shape.h>
24 #include <memory>
25 
26 class b2Fixture;
27 class b2Joint;
28 class b2Contact;
29 class b2Controller;
30 class b2World;
31 struct b2FixtureDef;
32 struct b2JointEdge;
33 struct b2ContactEdge;
34 
39 enum b2BodyType
40 {
41  b2_staticBody = 0,
42  b2_kinematicBody,
43  b2_dynamicBody
44 
45  // TODO_ERIN
46  //b2_bulletBody,
47 };
48 
51 struct b2BodyDef
52 {
55  {
56  userData = NULL;
57  position.Set(0.0f, 0.0f);
58  angle = 0.0f;
59  linearVelocity.Set(0.0f, 0.0f);
60  angularVelocity = 0.0f;
61  linearDamping = 0.0f;
62  angularDamping = 0.0f;
63  allowSleep = true;
64  awake = true;
65  fixedRotation = false;
66  bullet = false;
67  type = b2_staticBody;
68  active = true;
69  gravityScale = 1.0f;
70  }
71 
74  b2BodyType type;
75 
79 
81  float32 angle;
82 
85 
87  float32 angularVelocity;
88 
92  float32 linearDamping;
93 
97  float32 angularDamping;
98 
102 
104  bool awake;
105 
108 
113  bool bullet;
114 
116  bool active;
117 
119  void* userData;
120 
122  float32 gravityScale;
123 };
124 
126 class b2Body
127 {
128 public:
136  b2Fixture* CreateFixture(const b2FixtureDef* def);
137 
145  b2Fixture* CreateFixture(const b2Shape* shape, float32 density);
146 
154  void DestroyFixture(b2Fixture* fixture);
155 
161  void SetTransform(const b2Vec2& position, float32 angle);
162 
165  const b2Transform& GetTransform() const;
166 
169  const b2Vec2& GetPosition() const;
170 
173  float32 GetAngle() const;
174 
176  const b2Vec2& GetWorldCenter() const;
177 
179  const b2Vec2& GetLocalCenter() const;
180 
183  void SetLinearVelocity(const b2Vec2& v);
184 
187  const b2Vec2& GetLinearVelocity() const;
188 
191  void SetAngularVelocity(float32 omega);
192 
195  float32 GetAngularVelocity() const;
196 
203  void ApplyForce(const b2Vec2& force, const b2Vec2& point, bool wake);
204 
208  void ApplyForceToCenter(const b2Vec2& force, bool wake);
209 
214  void ApplyTorque(float32 torque, bool wake);
215 
222  void ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point, bool wake);
223 
227  void ApplyLinearImpulseToCenter(const b2Vec2& impulse, bool wake);
228 
232  void ApplyAngularImpulse(float32 impulse, bool wake);
233 
236  float32 GetMass() const;
237 
240  float32 GetInertia() const;
241 
244  void GetMassData(b2MassData* data) const;
245 
251  void SetMassData(const b2MassData* data);
252 
256  void ResetMassData();
257 
261  b2Vec2 GetWorldPoint(const b2Vec2& localPoint) const;
262 
266  b2Vec2 GetWorldVector(const b2Vec2& localVector) const;
267 
271  b2Vec2 GetLocalPoint(const b2Vec2& worldPoint) const;
272 
276  b2Vec2 GetLocalVector(const b2Vec2& worldVector) const;
277 
281  b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const;
282 
286  b2Vec2 GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const;
287 
289  float32 GetLinearDamping() const;
290 
292  void SetLinearDamping(float32 linearDamping);
293 
295  float32 GetAngularDamping() const;
296 
298  void SetAngularDamping(float32 angularDamping);
299 
301  float32 GetGravityScale() const;
302 
304  void SetGravityScale(float32 scale);
305 
307  void SetType(b2BodyType type);
308 
310  b2BodyType GetType() const;
311 
313  void SetBullet(bool flag);
314 
316  bool IsBullet() const;
317 
320  void SetSleepingAllowed(bool flag);
321 
323  bool IsSleepingAllowed() const;
324 
328  void SetAwake(bool flag);
329 
332  bool IsAwake() const;
333 
347  void SetActive(bool flag);
348 
350  bool IsActive() const;
351 
354  void SetFixedRotation(bool flag);
355 
357  bool IsFixedRotation() const;
358 
360  b2Fixture* GetFixtureList();
361  const b2Fixture* GetFixtureList() const;
362 
364  b2JointEdge* GetJointList();
365  const b2JointEdge* GetJointList() const;
366 
370  b2ContactEdge* GetContactList();
371  const b2ContactEdge* GetContactList() const;
372 
374  b2Body* GetNext();
375  const b2Body* GetNext() const;
376 
378  void* GetUserData() const;
379 
381  void SetUserData(void* data);
382 
384  b2World* GetWorld();
385  const b2World* GetWorld() const;
386 
388  void Dump();
389 
390 private:
391 
392  friend class b2World;
393  friend class b2Island;
394  friend class b2ContactManager;
395  friend class b2ContactSolver;
396  friend class b2Contact;
397 
398  friend class b2DistanceJoint;
399  friend class b2FrictionJoint;
400  friend class b2GearJoint;
401  friend class b2MotorJoint;
402  friend class b2MouseJoint;
403  friend class b2PrismaticJoint;
404  friend class b2PulleyJoint;
405  friend class b2RevoluteJoint;
406  friend class b2RopeJoint;
407  friend class b2WeldJoint;
408  friend class b2WheelJoint;
409 
410  // m_flags
411  enum
412  {
413  e_islandFlag = 0x0001,
414  e_awakeFlag = 0x0002,
415  e_autoSleepFlag = 0x0004,
416  e_bulletFlag = 0x0008,
417  e_fixedRotationFlag = 0x0010,
418  e_activeFlag = 0x0020,
419  e_toiFlag = 0x0040
420  };
421 
422  b2Body(const b2BodyDef* bd, b2World* world);
423  ~b2Body();
424 
425  void SynchronizeFixtures();
426  void SynchronizeTransform();
427 
428  // This is used to prevent connected bodies from colliding.
429  // It may lie, depending on the collideConnected flag.
430  bool ShouldCollide(const b2Body* other) const;
431 
432  void Advance(float32 t);
433 
434  b2BodyType m_type;
435 
436  uint16 m_flags;
437 
438  int32 m_islandIndex;
439 
440  b2Transform m_xf; // the body origin transform
441  b2Sweep m_sweep; // the swept motion for CCD
442 
443  b2Vec2 m_linearVelocity;
444  float32 m_angularVelocity;
445 
446  b2Vec2 m_force;
447  float32 m_torque;
448 
449  b2World* m_world;
450  b2Body* m_prev;
451  b2Body* m_next;
452 
453  b2Fixture* m_fixtureList;
454  int32 m_fixtureCount;
455 
456  b2JointEdge* m_jointList;
457  b2ContactEdge* m_contactList;
458 
459  float32 m_mass, m_invMass;
460 
461  // Rotational inertia about the center of mass.
462  float32 m_I, m_invI;
463 
464  float32 m_linearDamping;
465  float32 m_angularDamping;
466  float32 m_gravityScale;
467 
468  float32 m_sleepTime;
469 
470  void* m_userData;
471 };
472 
473 inline b2BodyType b2Body::GetType() const
474 {
475  return m_type;
476 }
477 
478 inline const b2Transform& b2Body::GetTransform() const
479 {
480  return m_xf;
481 }
482 
483 inline const b2Vec2& b2Body::GetPosition() const
484 {
485  return m_xf.p;
486 }
487 
488 inline float32 b2Body::GetAngle() const
489 {
490  return m_sweep.a;
491 }
492 
493 inline const b2Vec2& b2Body::GetWorldCenter() const
494 {
495  return m_sweep.c;
496 }
497 
498 inline const b2Vec2& b2Body::GetLocalCenter() const
499 {
500  return m_sweep.localCenter;
501 }
502 
503 inline void b2Body::SetLinearVelocity(const b2Vec2& v)
504 {
505  if (m_type == b2_staticBody)
506  {
507  return;
508  }
509 
510  if (b2Dot(v,v) > 0.0f)
511  {
512  SetAwake(true);
513  }
514 
515  m_linearVelocity = v;
516 }
517 
518 inline const b2Vec2& b2Body::GetLinearVelocity() const
519 {
520  return m_linearVelocity;
521 }
522 
523 inline void b2Body::SetAngularVelocity(float32 w)
524 {
525  if (m_type == b2_staticBody)
526  {
527  return;
528  }
529 
530  if (w * w > 0.0f)
531  {
532  SetAwake(true);
533  }
534 
535  m_angularVelocity = w;
536 }
537 
538 inline float32 b2Body::GetAngularVelocity() const
539 {
540  return m_angularVelocity;
541 }
542 
543 inline float32 b2Body::GetMass() const
544 {
545  return m_mass;
546 }
547 
548 inline float32 b2Body::GetInertia() const
549 {
550  return m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter);
551 }
552 
553 inline void b2Body::GetMassData(b2MassData* data) const
554 {
555  data->mass = m_mass;
556  data->I = m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter);
557  data->center = m_sweep.localCenter;
558 }
559 
560 inline b2Vec2 b2Body::GetWorldPoint(const b2Vec2& localPoint) const
561 {
562  return b2Mul(m_xf, localPoint);
563 }
564 
565 inline b2Vec2 b2Body::GetWorldVector(const b2Vec2& localVector) const
566 {
567  return b2Mul(m_xf.q, localVector);
568 }
569 
570 inline b2Vec2 b2Body::GetLocalPoint(const b2Vec2& worldPoint) const
571 {
572  return b2MulT(m_xf, worldPoint);
573 }
574 
575 inline b2Vec2 b2Body::GetLocalVector(const b2Vec2& worldVector) const
576 {
577  return b2MulT(m_xf.q, worldVector);
578 }
579 
581 {
582  return m_linearVelocity + b2Cross(m_angularVelocity, worldPoint - m_sweep.c);
583 }
584 
586 {
587  return GetLinearVelocityFromWorldPoint(GetWorldPoint(localPoint));
588 }
589 
590 inline float32 b2Body::GetLinearDamping() const
591 {
592  return m_linearDamping;
593 }
594 
596 {
597  m_linearDamping = linearDamping;
598 }
599 
600 inline float32 b2Body::GetAngularDamping() const
601 {
602  return m_angularDamping;
603 }
604 
606 {
607  m_angularDamping = angularDamping;
608 }
609 
610 inline float32 b2Body::GetGravityScale() const
611 {
612  return m_gravityScale;
613 }
614 
615 inline void b2Body::SetGravityScale(float32 scale)
616 {
617  m_gravityScale = scale;
618 }
619 
620 inline void b2Body::SetBullet(bool flag)
621 {
622  if (flag)
623  {
624  m_flags |= e_bulletFlag;
625  }
626  else
627  {
628  m_flags &= ~e_bulletFlag;
629  }
630 }
631 
632 inline bool b2Body::IsBullet() const
633 {
634  return (m_flags & e_bulletFlag) == e_bulletFlag;
635 }
636 
637 inline void b2Body::SetAwake(bool flag)
638 {
639  if (flag)
640  {
641  if ((m_flags & e_awakeFlag) == 0)
642  {
643  m_flags |= e_awakeFlag;
644  m_sleepTime = 0.0f;
645  }
646  }
647  else
648  {
649  m_flags &= ~e_awakeFlag;
650  m_sleepTime = 0.0f;
651  m_linearVelocity.SetZero();
652  m_angularVelocity = 0.0f;
653  m_force.SetZero();
654  m_torque = 0.0f;
655  }
656 }
657 
658 inline bool b2Body::IsAwake() const
659 {
660  return (m_flags & e_awakeFlag) == e_awakeFlag;
661 }
662 
663 inline bool b2Body::IsActive() const
664 {
665  return (m_flags & e_activeFlag) == e_activeFlag;
666 }
667 
668 inline bool b2Body::IsFixedRotation() const
669 {
670  return (m_flags & e_fixedRotationFlag) == e_fixedRotationFlag;
671 }
672 
673 inline void b2Body::SetSleepingAllowed(bool flag)
674 {
675  if (flag)
676  {
677  m_flags |= e_autoSleepFlag;
678  }
679  else
680  {
681  m_flags &= ~e_autoSleepFlag;
682  SetAwake(true);
683  }
684 }
685 
686 inline bool b2Body::IsSleepingAllowed() const
687 {
688  return (m_flags & e_autoSleepFlag) == e_autoSleepFlag;
689 }
690 
692 {
693  return m_fixtureList;
694 }
695 
696 inline const b2Fixture* b2Body::GetFixtureList() const
697 {
698  return m_fixtureList;
699 }
700 
702 {
703  return m_jointList;
704 }
705 
706 inline const b2JointEdge* b2Body::GetJointList() const
707 {
708  return m_jointList;
709 }
710 
712 {
713  return m_contactList;
714 }
715 
716 inline const b2ContactEdge* b2Body::GetContactList() const
717 {
718  return m_contactList;
719 }
720 
722 {
723  return m_next;
724 }
725 
726 inline const b2Body* b2Body::GetNext() const
727 {
728  return m_next;
729 }
730 
731 inline void b2Body::SetUserData(void* data)
732 {
733  m_userData = data;
734 }
735 
736 inline void* b2Body::GetUserData() const
737 {
738  return m_userData;
739 }
740 
741 inline void b2Body::ApplyForce(const b2Vec2& force, const b2Vec2& point, bool wake)
742 {
743  if (m_type != b2_dynamicBody)
744  {
745  return;
746  }
747 
748  if (wake && (m_flags & e_awakeFlag) == 0)
749  {
750  SetAwake(true);
751  }
752 
753  // Don't accumulate a force if the body is sleeping.
754  if (m_flags & e_awakeFlag)
755  {
756  m_force += force;
757  m_torque += b2Cross(point - m_sweep.c, force);
758  }
759 }
760 
761 inline void b2Body::ApplyForceToCenter(const b2Vec2& force, bool wake)
762 {
763  if (m_type != b2_dynamicBody)
764  {
765  return;
766  }
767 
768  if (wake && (m_flags & e_awakeFlag) == 0)
769  {
770  SetAwake(true);
771  }
772 
773  // Don't accumulate a force if the body is sleeping
774  if (m_flags & e_awakeFlag)
775  {
776  m_force += force;
777  }
778 }
779 
780 inline void b2Body::ApplyTorque(float32 torque, bool wake)
781 {
782  if (m_type != b2_dynamicBody)
783  {
784  return;
785  }
786 
787  if (wake && (m_flags & e_awakeFlag) == 0)
788  {
789  SetAwake(true);
790  }
791 
792  // Don't accumulate a force if the body is sleeping
793  if (m_flags & e_awakeFlag)
794  {
795  m_torque += torque;
796  }
797 }
798 
799 inline void b2Body::ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point, bool wake)
800 {
801  if (m_type != b2_dynamicBody)
802  {
803  return;
804  }
805 
806  if (wake && (m_flags & e_awakeFlag) == 0)
807  {
808  SetAwake(true);
809  }
810 
811  // Don't accumulate velocity if the body is sleeping
812  if (m_flags & e_awakeFlag)
813  {
814  m_linearVelocity += m_invMass * impulse;
815  m_angularVelocity += m_invI * b2Cross(point - m_sweep.c, impulse);
816  }
817 }
818 
819 inline void b2Body::ApplyLinearImpulseToCenter(const b2Vec2& impulse, bool wake)
820 {
821  if (m_type != b2_dynamicBody)
822  {
823  return;
824  }
825 
826  if (wake && (m_flags & e_awakeFlag) == 0)
827  {
828  SetAwake(true);
829  }
830 
831  // Don't accumulate velocity if the body is sleeping
832  if (m_flags & e_awakeFlag)
833  {
834  m_linearVelocity += m_invMass * impulse;
835  }
836 }
837 
838 inline void b2Body::ApplyAngularImpulse(float32 impulse, bool wake)
839 {
840  if (m_type != b2_dynamicBody)
841  {
842  return;
843  }
844 
845  if (wake && (m_flags & e_awakeFlag) == 0)
846  {
847  SetAwake(true);
848  }
849 
850  // Don't accumulate velocity if the body is sleeping
851  if (m_flags & e_awakeFlag)
852  {
853  m_angularVelocity += m_invI * impulse;
854  }
855 }
856 
857 inline void b2Body::SynchronizeTransform()
858 {
859  m_xf.q.Set(m_sweep.a);
860  m_xf.p = m_sweep.c - b2Mul(m_xf.q, m_sweep.localCenter);
861 }
862 
863 inline void b2Body::Advance(float32 alpha)
864 {
865  // Advance to the new safe time. This doesn't sync the broad-phase.
866  m_sweep.Advance(alpha);
867  m_sweep.c = m_sweep.c0;
868  m_sweep.a = m_sweep.a0;
869  m_xf.q.Set(m_sweep.a);
870  m_xf.p = m_sweep.c - b2Mul(m_xf.q, m_sweep.localCenter);
871 }
872 
874 {
875  return m_world;
876 }
877 
878 inline const b2World* b2Body::GetWorld() const
879 {
880  return m_world;
881 }
882 
883 #endif
b2BodyType type
Definition: b2Body.h:74
Definition: b2Math.h:350
b2JointEdge * GetJointList()
Get the list of all joints attached to this body.
Definition: b2Body.h:701
float32 GetInertia() const
Definition: b2Body.h:548
const b2Vec2 & GetWorldCenter() const
Get the world position of the center of mass.
Definition: b2Body.h:493
Definition: b2RopeJoint.h:58
bool active
Does this body start out active?
Definition: b2Body.h:116
b2ContactEdge * GetContactList()
Definition: b2Body.h:711
bool IsSleepingAllowed() const
Is this body allowed to sleep.
Definition: b2Body.h:686
float32 angularDamping
Definition: b2Body.h:97
void SetGravityScale(float32 scale)
Set the gravity scale of the body.
Definition: b2Body.h:615
void SetAwake(bool flag)
Definition: b2Body.h:637
Definition: b2MotorJoint.h:59
void ApplyLinearImpulseToCenter(const b2Vec2 &impulse, bool wake)
Definition: b2Body.h:819
float32 I
The rotational inertia of the shape about the local origin.
Definition: b2Shape.h:36
bool fixedRotation
Should this body be prevented from rotating? Useful for characters.
Definition: b2Body.h:107
void SetBullet(bool flag)
Should this body be treated like a bullet for continuous collision detection?
Definition: b2Body.h:620
Definition: b2Body.h:51
void SetAngularDamping(float32 angularDamping)
Set the angular damping of the body.
Definition: b2Body.h:605
b2Body * GetNext()
Get the next body in the world&#39;s body list.
Definition: b2Body.h:721
void * userData
Use this to store application specific body data.
Definition: b2Body.h:119
b2Vec2 position
Definition: b2Body.h:78
bool bullet
Definition: b2Body.h:113
float32 GetAngle() const
Definition: b2Body.h:488
Definition: b2World.h:41
float32 GetLinearDamping() const
Get the linear damping of the body.
Definition: b2Body.h:590
void ApplyAngularImpulse(float32 impulse, bool wake)
Definition: b2Body.h:838
b2Vec2 GetLinearVelocityFromLocalPoint(const b2Vec2 &localPoint) const
Definition: b2Body.h:585
float32 linearDamping
Definition: b2Body.h:92
Definition: b2Math.h:380
void SetLinearVelocity(const b2Vec2 &v)
Definition: b2Body.h:503
Definition: b2Joint.h:103
This holds the mass data computed for a shape.
Definition: b2Shape.h:27
b2Vec2 GetWorldPoint(const b2Vec2 &localPoint) const
Definition: b2Body.h:560
void SetUserData(void *data)
Set the user data. Use this to store your application specific data.
Definition: b2Body.h:731
Definition: b2Shape.h:42
Definition: b2PrismaticJoint.h:86
Definition: b2WeldJoint.h:62
Definition: b2MouseJoint.h:60
float32 gravityScale
Scale the gravity applied to this body.
Definition: b2Body.h:122
const b2Vec2 & GetPosition() const
Definition: b2Body.h:483
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:65
Definition: b2Contact.h:66
Definition: b2Fixture.h:56
void ApplyForceToCenter(const b2Vec2 &force, bool wake)
Definition: b2Body.h:761
Definition: b2GearJoint.h:56
b2Fixture * GetFixtureList()
Get the list of all fixtures attached to this body.
Definition: b2Body.h:691
Definition: b2FrictionJoint.h:55
bool IsAwake() const
Definition: b2Body.h:658
bool awake
Is this body initially awake or sleeping?
Definition: b2Body.h:104
void GetMassData(b2MassData *data) const
Definition: b2Body.h:553
b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2 &worldPoint) const
Definition: b2Body.h:580
float32 mass
The mass of the shape, usually in kilograms.
Definition: b2Shape.h:30
b2Vec2 center
The position of the shape&#39;s centroid relative to the shape&#39;s origin.
Definition: b2Shape.h:33
b2World * GetWorld()
Get the parent world of this body.
Definition: b2Body.h:873
Definition: b2DistanceJoint.h:67
b2BodyDef()
This constructor sets the body definition default values.
Definition: b2Body.h:54
void ApplyLinearImpulse(const b2Vec2 &impulse, const b2Vec2 &point, bool wake)
Definition: b2Body.h:799
void SetLinearDamping(float32 linearDamping)
Set the linear damping of the body.
Definition: b2Body.h:595
float32 angle
The world angle of the body in radians.
Definition: b2Body.h:81
b2Vec2 linearVelocity
The linear velocity of the body&#39;s origin in world co-ordinates.
Definition: b2Body.h:84
Definition: b2RevoluteJoint.h:90
void SetSleepingAllowed(bool flag)
Definition: b2Body.h:673
Definition: b2Joint.h:65
float32 angularVelocity
The angular velocity of the body.
Definition: b2Body.h:87
bool IsBullet() const
Is this body treated like a bullet for continuous collision detection?
Definition: b2Body.h:632
float32 GetAngularDamping() const
Get the angular damping of the body.
Definition: b2Body.h:600
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:126
void * GetUserData() const
Get the user data pointer that was provided in the body definition.
Definition: b2Body.h:736
const b2Vec2 & GetLocalCenter() const
Get the local position of the center of mass.
Definition: b2Body.h:498
This is an internal class.
Definition: b2Island.h:34
void ApplyForce(const b2Vec2 &force, const b2Vec2 &point, bool wake)
Definition: b2Body.h:741
const b2Vec2 & GetLinearVelocity() const
Definition: b2Body.h:518
b2Vec2 GetLocalVector(const b2Vec2 &worldVector) const
Definition: b2Body.h:575
void ApplyTorque(float32 torque, bool wake)
Definition: b2Body.h:780
A 2D column vector.
Definition: b2Math.h:53
Definition: b2Contact.h:77
b2BodyType GetType() const
Get the type of this body.
Definition: b2Body.h:473
bool IsFixedRotation() const
Does this body have fixed rotation?
Definition: b2Body.h:668
void SetAngularVelocity(float32 omega)
Definition: b2Body.h:523
float32 GetMass() const
Definition: b2Body.h:543
Definition: b2ContactManager.h:30
Definition: b2ContactSolver.h:69
Definition: b2PulleyJoint.h:79
float32 GetGravityScale() const
Get the gravity scale of the body.
Definition: b2Body.h:610
bool IsActive() const
Get the active state of the body.
Definition: b2Body.h:663
Definition: b2WheelJoint.h:78
b2Vec2 GetWorldVector(const b2Vec2 &localVector) const
Definition: b2Body.h:565
float32 GetAngularVelocity() const
Definition: b2Body.h:538
bool allowSleep
Definition: b2Body.h:101
Definition: b2Fixture.h:107
b2Vec2 GetLocalPoint(const b2Vec2 &worldPoint) const
Definition: b2Body.h:570
const b2Transform & GetTransform() const
Definition: b2Body.h:478