LiquidFun
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
b2Body.h
1 /*
2 * Copyright (c) 2006-2011 Erin Catto http://www.box2d.org
3 * Copyright (c) 2013 Google, Inc.
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 * 2. Altered source versions must be plainly marked as such, and must not be
16 * misrepresented as being the original software.
17 * 3. This notice may not be removed or altered from any source distribution.
18 */
19 
20 #ifndef B2_BODY_H
21 #define B2_BODY_H
22 
23 #include <Box2D/Common/b2Math.h>
24 #include <Box2D/Collision/Shapes/b2Shape.h>
25 #include <memory>
26 
27 class b2Fixture;
28 class b2Joint;
29 class b2Contact;
30 class b2Controller;
31 class b2World;
32 struct b2FixtureDef;
33 struct b2JointEdge;
34 struct b2ContactEdge;
35 
40 enum b2BodyType
41 {
42  b2_staticBody = 0,
43  b2_kinematicBody,
44  b2_dynamicBody
45 
46  // TODO_ERIN
47  //b2_bulletBody,
48 };
49 
52 struct b2BodyDef
53 {
56  {
57  userData = NULL;
58  position.Set(0.0f, 0.0f);
59  angle = 0.0f;
60  linearVelocity.Set(0.0f, 0.0f);
61  angularVelocity = 0.0f;
62  linearDamping = 0.0f;
63  angularDamping = 0.0f;
64  allowSleep = true;
65  awake = true;
66  fixedRotation = false;
67  bullet = false;
68  type = b2_staticBody;
69  active = true;
70  gravityScale = 1.0f;
71  }
72 
75  b2BodyType type;
76 
80 
82  float32 angle;
83 
86 
88  float32 angularVelocity;
89 
93  float32 linearDamping;
94 
98  float32 angularDamping;
99 
103 
105  bool awake;
106 
109 
114  bool bullet;
115 
117  bool active;
118 
120  void* userData;
121 
123  float32 gravityScale;
124 };
125 
127 class b2Body
128 {
129 public:
137  b2Fixture* CreateFixture(const b2FixtureDef* def);
138 
146  b2Fixture* CreateFixture(const b2Shape* shape, float32 density);
147 
155  void DestroyFixture(b2Fixture* fixture);
156 
162  void SetTransform(const b2Vec2& position, float32 angle);
163 
166  const b2Transform& GetTransform() const;
167 
170  const b2Vec2& GetPosition() const;
171 
174  float32 GetAngle() const;
175 
177  const b2Vec2& GetWorldCenter() const;
178 
180  const b2Vec2& GetLocalCenter() const;
181 
184  void SetLinearVelocity(const b2Vec2& v);
185 
188  const b2Vec2& GetLinearVelocity() const;
189 
192  void SetAngularVelocity(float32 omega);
193 
196  float32 GetAngularVelocity() const;
197 
204  void ApplyForce(const b2Vec2& force, const b2Vec2& point, bool wake);
205 
209  void ApplyForceToCenter(const b2Vec2& force, bool wake);
210 
216  void ApplyTorque(float32 torque, bool wake);
217 
224  void ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point, bool wake);
225 
229  void ApplyAngularImpulse(float32 impulse, bool wake);
230 
233  float32 GetMass() const;
234 
237  float32 GetInertia() const;
238 
241  void GetMassData(b2MassData* data) const;
242 
248  void SetMassData(const b2MassData* data);
249 
253  void ResetMassData();
254 
258  b2Vec2 GetWorldPoint(const b2Vec2& localPoint) const;
259 
263  b2Vec2 GetWorldVector(const b2Vec2& localVector) const;
264 
268  b2Vec2 GetLocalPoint(const b2Vec2& worldPoint) const;
269 
273  b2Vec2 GetLocalVector(const b2Vec2& worldVector) const;
274 
278  b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const;
279 
283  b2Vec2 GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const;
284 
286  float32 GetLinearDamping() const;
287 
289  void SetLinearDamping(float32 linearDamping);
290 
292  float32 GetAngularDamping() const;
293 
295  void SetAngularDamping(float32 angularDamping);
296 
298  float32 GetGravityScale() const;
299 
301  void SetGravityScale(float32 scale);
302 
304  void SetType(b2BodyType type);
305 
307  b2BodyType GetType() const;
308 
310  void SetBullet(bool flag);
311 
313  bool IsBullet() const;
314 
317  void SetSleepingAllowed(bool flag);
318 
320  bool IsSleepingAllowed() const;
321 
325  void SetAwake(bool flag);
326 
329  bool IsAwake() const;
330 
344  void SetActive(bool flag);
345 
347  bool IsActive() const;
348 
351  void SetFixedRotation(bool flag);
352 
354  bool IsFixedRotation() const;
355 
358  const b2Fixture* GetFixtureList() const;
359 
362  const b2JointEdge* GetJointList() const;
363 
368  const b2ContactEdge* GetContactList() const;
369 
371  b2Body* GetNext();
372  const b2Body* GetNext() const;
373 
375  void* GetUserData() const;
376 
378  void SetUserData(void* data);
379 
381  b2World* GetWorld();
382  const b2World* GetWorld() const;
383 
385  void Dump();
386 
387 private:
388 
389  friend class b2World;
390  friend class b2Island;
391  friend class b2ContactManager;
392  friend class b2ContactSolver;
393  friend class b2Contact;
394 
395  friend class b2DistanceJoint;
396  friend class b2FrictionJoint;
397  friend class b2GearJoint;
398  friend class b2MotorJoint;
399  friend class b2MouseJoint;
400  friend class b2PrismaticJoint;
401  friend class b2PulleyJoint;
402  friend class b2RevoluteJoint;
403  friend class b2RopeJoint;
404  friend class b2WeldJoint;
405  friend class b2WheelJoint;
406 
407  friend class b2ParticleSystem;
408  friend class b2ParticleGroup;
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  b2Transform m_xf0; // the previous transform for particle simulation
442  b2Sweep m_sweep; // the swept motion for CCD
443 
444  b2Vec2 m_linearVelocity;
445  float32 m_angularVelocity;
446 
447  b2Vec2 m_force;
448  float32 m_torque;
449 
450  b2World* m_world;
451  b2Body* m_prev;
452  b2Body* m_next;
453 
454  b2Fixture* m_fixtureList;
455  int32 m_fixtureCount;
456 
457  b2JointEdge* m_jointList;
458  b2ContactEdge* m_contactList;
459 
460  float32 m_mass, m_invMass;
461 
462  // Rotational inertia about the center of mass.
463  float32 m_I, m_invI;
464 
465  float32 m_linearDamping;
466  float32 m_angularDamping;
467  float32 m_gravityScale;
468 
469  float32 m_sleepTime;
470 
471  void* m_userData;
472 };
473 
474 inline b2BodyType b2Body::GetType() const
475 {
476  return m_type;
477 }
478 
479 inline const b2Transform& b2Body::GetTransform() const
480 {
481  return m_xf;
482 }
483 
484 inline const b2Vec2& b2Body::GetPosition() const
485 {
486  return m_xf.p;
487 }
488 
489 inline float32 b2Body::GetAngle() const
490 {
491  return m_sweep.a;
492 }
493 
494 inline const b2Vec2& b2Body::GetWorldCenter() const
495 {
496  return m_sweep.c;
497 }
498 
499 inline const b2Vec2& b2Body::GetLocalCenter() const
500 {
501  return m_sweep.localCenter;
502 }
503 
504 inline void b2Body::SetLinearVelocity(const b2Vec2& v)
505 {
506  if (m_type == b2_staticBody)
507  {
508  return;
509  }
510 
511  if (b2Dot(v,v) > 0.0f)
512  {
513  SetAwake(true);
514  }
515 
516  m_linearVelocity = v;
517 }
518 
519 inline const b2Vec2& b2Body::GetLinearVelocity() const
520 {
521  return m_linearVelocity;
522 }
523 
524 inline void b2Body::SetAngularVelocity(float32 w)
525 {
526  if (m_type == b2_staticBody)
527  {
528  return;
529  }
530 
531  if (w * w > 0.0f)
532  {
533  SetAwake(true);
534  }
535 
536  m_angularVelocity = w;
537 }
538 
539 inline float32 b2Body::GetAngularVelocity() const
540 {
541  return m_angularVelocity;
542 }
543 
544 inline float32 b2Body::GetMass() const
545 {
546  return m_mass;
547 }
548 
549 inline float32 b2Body::GetInertia() const
550 {
551  return m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter);
552 }
553 
554 inline void b2Body::GetMassData(b2MassData* data) const
555 {
556  data->mass = m_mass;
557  data->I = m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter);
558  data->center = m_sweep.localCenter;
559 }
560 
561 inline b2Vec2 b2Body::GetWorldPoint(const b2Vec2& localPoint) const
562 {
563  return b2Mul(m_xf, localPoint);
564 }
565 
566 inline b2Vec2 b2Body::GetWorldVector(const b2Vec2& localVector) const
567 {
568  return b2Mul(m_xf.q, localVector);
569 }
570 
571 inline b2Vec2 b2Body::GetLocalPoint(const b2Vec2& worldPoint) const
572 {
573  return b2MulT(m_xf, worldPoint);
574 }
575 
576 inline b2Vec2 b2Body::GetLocalVector(const b2Vec2& worldVector) const
577 {
578  return b2MulT(m_xf.q, worldVector);
579 }
580 
582 {
583  return m_linearVelocity + b2Cross(m_angularVelocity, worldPoint - m_sweep.c);
584 }
585 
587 {
589 }
590 
591 inline float32 b2Body::GetLinearDamping() const
592 {
593  return m_linearDamping;
594 }
595 
596 inline void b2Body::SetLinearDamping(float32 linearDamping)
597 {
598  m_linearDamping = linearDamping;
599 }
600 
601 inline float32 b2Body::GetAngularDamping() const
602 {
603  return m_angularDamping;
604 }
605 
606 inline void b2Body::SetAngularDamping(float32 angularDamping)
607 {
608  m_angularDamping = angularDamping;
609 }
610 
611 inline float32 b2Body::GetGravityScale() const
612 {
613  return m_gravityScale;
614 }
615 
616 inline void b2Body::SetGravityScale(float32 scale)
617 {
618  m_gravityScale = scale;
619 }
620 
621 inline void b2Body::SetBullet(bool flag)
622 {
623  if (flag)
624  {
625  m_flags |= e_bulletFlag;
626  }
627  else
628  {
629  m_flags &= ~e_bulletFlag;
630  }
631 }
632 
633 inline bool b2Body::IsBullet() const
634 {
635  return (m_flags & e_bulletFlag) == e_bulletFlag;
636 }
637 
638 inline void b2Body::SetAwake(bool flag)
639 {
640  if (flag)
641  {
642  if ((m_flags & e_awakeFlag) == 0)
643  {
644  m_flags |= e_awakeFlag;
645  m_sleepTime = 0.0f;
646  }
647  }
648  else
649  {
650  m_flags &= ~e_awakeFlag;
651  m_sleepTime = 0.0f;
652  m_linearVelocity.SetZero();
653  m_angularVelocity = 0.0f;
654  m_force.SetZero();
655  m_torque = 0.0f;
656  }
657 }
658 
659 inline bool b2Body::IsAwake() const
660 {
661  return (m_flags & e_awakeFlag) == e_awakeFlag;
662 }
663 
664 inline bool b2Body::IsActive() const
665 {
666  return (m_flags & e_activeFlag) == e_activeFlag;
667 }
668 
669 inline bool b2Body::IsFixedRotation() const
670 {
671  return (m_flags & e_fixedRotationFlag) == e_fixedRotationFlag;
672 }
673 
674 inline void b2Body::SetSleepingAllowed(bool flag)
675 {
676  if (flag)
677  {
678  m_flags |= e_autoSleepFlag;
679  }
680  else
681  {
682  m_flags &= ~e_autoSleepFlag;
683  SetAwake(true);
684  }
685 }
686 
687 inline bool b2Body::IsSleepingAllowed() const
688 {
689  return (m_flags & e_autoSleepFlag) == e_autoSleepFlag;
690 }
691 
693 {
694  return m_fixtureList;
695 }
696 
697 inline const b2Fixture* b2Body::GetFixtureList() const
698 {
699  return m_fixtureList;
700 }
701 
703 {
704  return m_jointList;
705 }
706 
707 inline const b2JointEdge* b2Body::GetJointList() const
708 {
709  return m_jointList;
710 }
711 
713 {
714  return m_contactList;
715 }
716 
717 inline const b2ContactEdge* b2Body::GetContactList() const
718 {
719  return m_contactList;
720 }
721 
723 {
724  return m_next;
725 }
726 
727 inline const b2Body* b2Body::GetNext() const
728 {
729  return m_next;
730 }
731 
732 inline void b2Body::SetUserData(void* data)
733 {
734  m_userData = data;
735 }
736 
737 inline void* b2Body::GetUserData() const
738 {
739  return m_userData;
740 }
741 
742 inline void b2Body::ApplyForce(const b2Vec2& force, const b2Vec2& point, bool wake)
743 {
744  if (m_type != b2_dynamicBody)
745  {
746  return;
747  }
748 
749  if (wake && (m_flags & e_awakeFlag) == 0)
750  {
751  SetAwake(true);
752  }
753 
754  // Don't accumulate a force if the body is sleeping.
755  if (m_flags & e_awakeFlag)
756  {
757  m_force += force;
758  m_torque += b2Cross(point - m_sweep.c, force);
759  }
760 }
761 
762 inline void b2Body::ApplyForceToCenter(const b2Vec2& force, bool wake)
763 {
764  if (m_type != b2_dynamicBody)
765  {
766  return;
767  }
768 
769  if (wake && (m_flags & e_awakeFlag) == 0)
770  {
771  SetAwake(true);
772  }
773 
774  // Don't accumulate a force if the body is sleeping
775  if (m_flags & e_awakeFlag)
776  {
777  m_force += force;
778  }
779 }
780 
781 inline void b2Body::ApplyTorque(float32 torque, bool wake)
782 {
783  if (m_type != b2_dynamicBody)
784  {
785  return;
786  }
787 
788  if (wake && (m_flags & e_awakeFlag) == 0)
789  {
790  SetAwake(true);
791  }
792 
793  // Don't accumulate a force if the body is sleeping
794  if (m_flags & e_awakeFlag)
795  {
796  m_torque += torque;
797  }
798 }
799 
800 inline void b2Body::ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point, bool wake)
801 {
802  if (m_type != b2_dynamicBody)
803  {
804  return;
805  }
806 
807  if (wake && (m_flags & e_awakeFlag) == 0)
808  {
809  SetAwake(true);
810  }
811 
812  // Don't accumulate velocity if the body is sleeping
813  if (m_flags & e_awakeFlag)
814  {
815  m_linearVelocity += m_invMass * impulse;
816  m_angularVelocity += m_invI * b2Cross(point - m_sweep.c, impulse);
817  }
818 }
819 
820 inline void b2Body::ApplyAngularImpulse(float32 impulse, bool wake)
821 {
822  if (m_type != b2_dynamicBody)
823  {
824  return;
825  }
826 
827  if (wake && (m_flags & e_awakeFlag) == 0)
828  {
829  SetAwake(true);
830  }
831 
832  // Don't accumulate velocity if the body is sleeping
833  if (m_flags & e_awakeFlag)
834  {
835  m_angularVelocity += m_invI * impulse;
836  }
837 }
838 
839 inline void b2Body::SynchronizeTransform()
840 {
841  m_xf.q.Set(m_sweep.a);
842  m_xf.p = m_sweep.c - b2Mul(m_xf.q, m_sweep.localCenter);
843 }
844 
845 inline void b2Body::Advance(float32 alpha)
846 {
847  // Advance to the new safe time. This doesn't sync the broad-phase.
848  m_sweep.Advance(alpha);
849  m_sweep.c = m_sweep.c0;
850  m_sweep.a = m_sweep.a0;
851  m_xf.q.Set(m_sweep.a);
852  m_xf.p = m_sweep.c - b2Mul(m_xf.q, m_sweep.localCenter);
853 }
854 
856 {
857  return m_world;
858 }
859 
860 inline const b2World* b2Body::GetWorld() const
861 {
862  return m_world;
863 }
864 
865 #endif
b2BodyType type
Definition: b2Body.h:75
Definition: b2Math.h:411
void ResetMassData()
Definition: b2Body.cpp:287
b2JointEdge * GetJointList()
Get the list of all joints attached to this body.
Definition: b2Body.h:702
float32 GetInertia() const
Definition: b2Body.h:549
float32 GetAngularDamping() const
Get the angular damping of the body.
Definition: b2Body.h:601
float32 GetAngle() const
Definition: b2Body.h:489
void SetActive(bool flag)
Definition: b2Body.cpp:461
Definition: b2RopeJoint.h:58
bool active
Does this body start out active?
Definition: b2Body.h:117
b2ContactEdge * GetContactList()
Definition: b2Body.h:712
float32 GetAngularVelocity() const
Definition: b2Body.h:539
float32 angularDamping
Definition: b2Body.h:98
float32 GetGravityScale() const
Get the gravity scale of the body.
Definition: b2Body.h:611
void SetGravityScale(float32 scale)
Set the gravity scale of the body.
Definition: b2Body.h:616
void GetMassData(b2MassData *data) const
Definition: b2Body.h:554
void SetAwake(bool flag)
Definition: b2Body.h:638
Definition: b2MotorJoint.h:59
b2BodyType GetType() const
Get the type of this body.
Definition: b2Body.h:474
b2Vec2 GetWorldVector(const b2Vec2 &localVector) const
Definition: b2Body.h:566
float32 GetLinearDamping() const
Get the linear damping of the body.
Definition: b2Body.h:591
float32 I
The rotational inertia of the shape about the local origin.
Definition: b2Shape.h:37
bool fixedRotation
Should this body be prevented from rotating? Useful for characters.
Definition: b2Body.h:108
void SetTransform(const b2Vec2 &position, float32 angle)
Definition: b2Body.cpp:423
void SetBullet(bool flag)
Should this body be treated like a bullet for continuous collision detection?
Definition: b2Body.h:621
Definition: b2Body.h:52
void SetAngularDamping(float32 angularDamping)
Set the angular damping of the body.
Definition: b2Body.h:606
b2Body * GetNext()
Get the next body in the world&#39;s body list.
Definition: b2Body.h:722
void * userData
Use this to store application specific body data.
Definition: b2Body.h:120
b2Vec2 position
Definition: b2Body.h:79
const b2Vec2 & GetLinearVelocity() const
Definition: b2Body.h:519
bool bullet
Definition: b2Body.h:114
b2Vec2 GetLinearVelocityFromLocalPoint(const b2Vec2 &localPoint) const
Definition: b2Body.h:586
Definition: b2World.h:44
Definition: b2ParticleSystem.h:189
void ApplyAngularImpulse(float32 impulse, bool wake)
Definition: b2Body.h:820
float32 linearDamping
Definition: b2Body.h:93
Definition: b2Math.h:441
void SetLinearVelocity(const b2Vec2 &v)
Definition: b2Body.h:504
Definition: b2Joint.h:103
This holds the mass data computed for a shape.
Definition: b2Shape.h:28
void SetUserData(void *data)
Set the user data. Use this to store your application specific data.
Definition: b2Body.h:732
Definition: b2Shape.h:43
bool IsFixedRotation() const
Does this body have fixed rotation?
Definition: b2Body.h:669
void SetMassData(const b2MassData *data)
Definition: b2Body.cpp:359
b2Vec2 GetLocalVector(const b2Vec2 &worldVector) const
Definition: b2Body.h:576
float32 a
world angles
Definition: b2Math.h:456
Definition: b2PrismaticJoint.h:86
Definition: b2WeldJoint.h:62
void DestroyFixture(b2Fixture *fixture)
Definition: b2Body.cpp:216
Definition: b2MouseJoint.h:60
b2Fixture * CreateFixture(const b2FixtureDef *def)
Definition: b2Body.cpp:168
float32 GetMass() const
Definition: b2Body.h:544
float32 gravityScale
Scale the gravity applied to this body.
Definition: b2Body.h:123
bool IsActive() const
Get the active state of the body.
Definition: b2Body.h:664
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:68
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:65
void SetType(b2BodyType type)
Set the type of this body. This may alter the mass and velocity.
Definition: b2Body.cpp:115
Definition: b2Contact.h:66
bool IsBullet() const
Is this body treated like a bullet for continuous collision detection?
Definition: b2Body.h:633
Definition: b2Fixture.h:57
void ApplyForceToCenter(const b2Vec2 &force, bool wake)
Definition: b2Body.h:762
Definition: b2GearJoint.h:56
b2Fixture * GetFixtureList()
Get the list of all fixtures attached to this body.
Definition: b2Body.h:692
Definition: b2FrictionJoint.h:55
A group of particles. b2ParticleGroup::CreateParticleGroup creates these.
Definition: b2ParticleGroup.h:134
void SetFixedRotation(bool flag)
Definition: b2Body.cpp:506
bool awake
Is this body initially awake or sleeping?
Definition: b2Body.h:105
float32 mass
The mass of the shape, usually in kilograms.
Definition: b2Shape.h:31
bool IsSleepingAllowed() const
Is this body allowed to sleep.
Definition: b2Body.h:687
b2Vec2 center
The position of the shape&#39;s centroid relative to the shape&#39;s origin.
Definition: b2Shape.h:34
b2Vec2 c
center world positions
Definition: b2Math.h:455
void * GetUserData() const
Get the user data pointer that was provided in the body definition.
Definition: b2Body.h:737
b2World * GetWorld()
Get the parent world of this body.
Definition: b2Body.h:855
b2Vec2 localCenter
local center of mass position
Definition: b2Math.h:454
Definition: b2DistanceJoint.h:67
b2BodyDef()
This constructor sets the body definition default values.
Definition: b2Body.h:55
void ApplyLinearImpulse(const b2Vec2 &impulse, const b2Vec2 &point, bool wake)
Definition: b2Body.h:800
void SetLinearDamping(float32 linearDamping)
Set the linear damping of the body.
Definition: b2Body.h:596
b2Vec2 GetWorldPoint(const b2Vec2 &localPoint) const
Definition: b2Body.h:561
float32 angle
The world angle of the body in radians.
Definition: b2Body.h:82
b2Vec2 linearVelocity
The linear velocity of the body&#39;s origin in world co-ordinates.
Definition: b2Body.h:85
Definition: b2RevoluteJoint.h:90
void SetSleepingAllowed(bool flag)
Definition: b2Body.h:674
Definition: b2Joint.h:65
float32 angularVelocity
The angular velocity of the body.
Definition: b2Body.h:88
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:127
This is an internal class.
Definition: b2Island.h:34
bool IsAwake() const
Definition: b2Body.h:659
const b2Transform & GetTransform() const
Definition: b2Body.h:479
const b2Vec2 & GetLocalCenter() const
Get the local position of the center of mass.
Definition: b2Body.h:499
void ApplyForce(const b2Vec2 &force, const b2Vec2 &point, bool wake)
Definition: b2Body.h:742
const b2Vec2 & GetPosition() const
Definition: b2Body.h:484
void ApplyTorque(float32 torque, bool wake)
Definition: b2Body.h:781
b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2 &worldPoint) const
Definition: b2Body.h:581
A 2D column vector.
Definition: b2Math.h:56
Definition: b2Contact.h:77
void Advance(float32 alpha)
Definition: b2Math.h:768
void Set(float32 angle)
Set using an angle in radians.
Definition: b2Math.h:373
b2Vec2 GetLocalPoint(const b2Vec2 &worldPoint) const
Definition: b2Body.h:571
void SetAngularVelocity(float32 omega)
Definition: b2Body.h:524
Definition: b2ContactManager.h:31
Definition: b2ContactSolver.h:69
Definition: b2PulleyJoint.h:79
Definition: b2WheelJoint.h:79
const b2Vec2 & GetWorldCenter() const
Get the world position of the center of mass.
Definition: b2Body.h:494
void Dump()
Dump this body to a log file.
Definition: b2Body.cpp:528
bool allowSleep
Definition: b2Body.h:102
Definition: b2Fixture.h:108