diff --git a/sources/reactphysics3d/body/Body.h b/sources/reactphysics3d/body/Body.h
new file mode 100644
index 00000000..826937ba
--- /dev/null
+++ b/sources/reactphysics3d/body/Body.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+ #ifndef BODY_H
+ #define BODY_H
+
+// Namespace reactphysics3d
+namespace reactphysics3d {
+
+/* -------------------------------------------------------------------
+ Class Body :
+ This class is an abstract class to represent body of the physics
+ engine.
+ -------------------------------------------------------------------
+*/
+class Body {
+ private :
+ double mass; // Mass of the body
+
+ public :
+ Body(double mass); // Constructor
+ double getMass(); // Return the mass of the body
+ void setMass(double mass); // Set the mass of the body
+};
+
+// --- Inlines function --- //
+
+// Method that return the mass of the body
+inline double Body::getMass() {
+ return mass;
+};
+
+// Method that set the mass of the body
+inline void Body::setMass(double mass) {
+ this->mass = mass;
+}
+
+}
+
+ #endif
diff --git a/sources/reactphysics3d/body/BodyState.cpp b/sources/reactphysics3d/body/BodyState.cpp
new file mode 100644
index 00000000..3fde2bae
--- /dev/null
+++ b/sources/reactphysics3d/body/BodyState.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+ // Libraries
+ #include "BodyState.h"
+
+ // We want to use the ReactPhysics3D namespace
+ using namespace reactphysics3d;
+
+ // Constructor
+ BodyState::BodyState(const Vector3D& position, const Matrix3x3& inertiaTensorInverse, double massInverse) {
+ this->position = position;
+ this->inertiaTensorInverse = inertiaTensorInverse;
+ this->massInverse = massInverse;
+ }
+
+// Copy-constructor
+BodyState::BodyState(const BodyState& bodyState) {
+ this->position = bodyState.position;
+ this->linearMomentum = bodyState.linearMomentum;
+ this->orientation = bodyState.orientation;
+ this->angularMomentum = bodyState.angularMomentum;
+ this->linearVelocity = bodyState.linearVelocity;
+ this->angularVelocity = bodyState.angularVelocity;
+ this->spin = bodyState.spin;
+ this->inertiaTensorInverse = bodyState.inertiaTensorInverse;
+ this->massInverse = bodyState.massInverse;
+}
+
+// Destructor
+BodyState::~BodyState() {
+
+}
+
+// Recalculate the secondary values of the BodyState when the primary values have changed
+void BodyState::recalculate() {
+ // TODO : Implement this method
+}
+
diff --git a/sources/reactphysics3d/body/BodyState.h b/sources/reactphysics3d/body/BodyState.h
new file mode 100644
index 00000000..e00a29c6
--- /dev/null
+++ b/sources/reactphysics3d/body/BodyState.h
@@ -0,0 +1,136 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+#ifndef BODYSTATE_H
+#define BODYSTATE_H
+
+// Libraries
+#include "../mathematics/mathematics.h"
+
+// Namespace reactphysics3d
+namespace reactphysics3d {
+
+/* -------------------------------------------------------------------
+ Class BodyState :
+ A BodyState contains all the dynamics values of a body.
+ -------------------------------------------------------------------
+*/
+class BodyState {
+ private :
+ // Primary values
+ Vector3D position; // Position of the body
+ Vector3D linearMomentum; // Linear momentum of the body
+ Quaternion orientation; // Orientation quaternion of the body
+ Vector3D angularMomentum; // Angular momentum of the body
+
+ // Secondary values
+ Vector3D linearVelocity; // Linear velocity of the body
+ Vector3D angularVelocity; // Angular velocity of the body
+ Quaternion spin; // Spin is the derivative of orientation quaternion over time.
+
+ // Constants
+ Matrix3x3 inertiaTensorInverse; // Inverse of the inertia tensor of the body
+ double massInverse; // Inverse of the mass of the body
+
+ public :
+ BodyState(const Vector3D& position, const Matrix3x3& inertiaTensorInverse, double massInverse); // Constructor
+ BodyState(const BodyState& bodyState); // Copy-constructor
+ virtual ~BodyState(); // Destructor
+
+ Vector3D getPosition() const; // Return the position of the body
+ void setPosition(const Vector3D& position); // Set the position of the body
+ Vector3D getLinearMomentum() const; // Return the linear momemtum
+ void setLinearMomentum(const Vector3D& linearMomentum); // Set the linear momentum
+ Quaternion getOrientation() const; // Return the orientation quaternion
+ void setOrientation(const Quaternion& orientation); // Set the orientation quaternion
+ Vector3D getAngularMomentum() const; // Return the angular momentum
+ void setAngularMomentum(const Vector3D& angularMomentum); // Set the angular momentum
+ Vector3D getAngularVelocity() const; // Return the angular velocity
+ Quaternion getSpin() const; // Return the spin of the body
+ void setMassInverse(double massInverse); // Set the inverse of the mass
+ void setInertiaTensorInverse(const Matrix3x3& inertiaTensorInverse); // Set the inverse of the inertia tensor
+
+ void recalculate(); // Recalculate the secondary values of the BodyState
+};
+
+// --- Inlines functions --- //
+
+// Return the position of the body
+inline Vector3D BodyState::getPosition() const {
+ return position;
+}
+
+// Set the position of the body
+inline void BodyState::setPosition(const Vector3D& position) {
+ this->position = position;
+}
+
+// Return the linear momentum of the body
+inline Vector3D BodyState::getLinearMomentum() const {
+ return linearMomentum;
+}
+
+// Set the linear momentum of the body
+inline void BodyState::setLinearMomentum(const Vector3D& linearMomentum) {
+ this->linearMomentum = linearMomentum;
+}
+
+// Return the orientation quaternion of the body
+inline Quaternion BodyState::getOrientation() const {
+ return orientation;
+}
+
+// Set the orientation quaternion
+inline void BodyState::setOrientation(const Quaternion& orientation) {
+ this->orientation = orientation;
+}
+
+// Return the angular momentum of the body
+inline Vector3D BodyState::getAngularMomentum() const {
+ return angularMomentum;
+}
+
+// Set the angular momentum of the body
+inline void BodyState::setAngularMomentum(const Vector3D& angularMomentum) {
+ this->angularMomentum = angularMomentum;
+}
+
+// Return the angular velocity of the body
+inline Vector3D BodyState::getAngularVelocity() const {
+ return angularVelocity;
+}
+
+// Return the spin of the body
+inline Quaternion BodyState::getSpin() const {
+ return spin;
+}
+
+// Set the inverse of the mass
+inline void BodyState::setMassInverse(double massInverse) {
+ this->massInverse = massInverse;
+}
+
+// Set the inverse of the inertia tensor
+inline void BodyState::setInertiaTensorInverse(const Matrix3x3& inertiaTensorInverse) {
+ this->inertiaTensorInverse = inertiaTensorInverse;
+}
+
+}
+
+#endif
diff --git a/sources/reactphysics3d/body/RigidBody.h b/sources/reactphysics3d/body/RigidBody.h
new file mode 100644
index 00000000..57327b27
--- /dev/null
+++ b/sources/reactphysics3d/body/RigidBody.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+ * Copyright (C) 2009 Daniel Chappuis *
+ ****************************************************************************
+ * This file is part of ReactPhysics3D. *
+ * *
+ * ReactPhysics3D is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * ReactPhysics3D is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with ReactPhysics3D. If not, see . *
+ ***************************************************************************/
+
+ #ifndef RIGIDBODY_H
+ #define RIGIDBODY_H
+
+ // Libraries
+ #include "Body.h"
+ #include "../mathematics/mathematics.h"
+
+// Namespace reactphysics3d
+namespace reactphysics3d {
+
+/* -------------------------------------------------------------------
+ Class RigidBody :
+ This class represents a rigid body of the physics
+ engine. A rigid body is a non-deformable body that
+ has a constant mass.
+ -------------------------------------------------------------------
+*/
+class RigidBody : public Body {
+ private :
+ Matrix3x3 inertiaTensor; // Inertia tensor of the body
+ BodyState currentBodyState; // Current body state
+ BodyState previousBodyState; // Previous body state
+ bool isMotionEnabled; // True if the body can move
+ bool isCollisionEnabled; // True if the body can collide with others bodies
+
+ public :
+ RigidBody(double mass); // Constructor
+ RigidBody(const RigidBody& rigidBody); // Copy-constructor
+ virtual ~RigidBody(); // Destructor
+
+ Matrix3x3 getInertiaTensor() const; // Return the inertia tensor of the body
+ void setInertiaTensor(const Matrix3x3& inertiaTensor); // Set the inertia tensor of the body
+ BodyState getCurrentState() const; // Return the current state of the body
+ BodyState getPreviousState() const; // Return the previous state of the body
+};
+
+
+}
+
+ #endif