Add the isCollisionEnabled and isMotionEnabled value
git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@342 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
23438486a6
commit
92dabf7f7f
|
@ -34,16 +34,22 @@ namespace reactphysics3d {
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
class Body {
|
class Body {
|
||||||
private :
|
protected :
|
||||||
Kilogram mass; // Mass of the body
|
Kilogram mass; // Mass of the body
|
||||||
|
bool isMotionEnabled; // True if the body is able to move
|
||||||
|
bool isCollisionEnabled; // True if the body can collide with others bodies
|
||||||
|
|
||||||
public :
|
public :
|
||||||
Body(Kilogram mass) throw(std::invalid_argument); // Constructor
|
Body(Kilogram mass) throw(std::invalid_argument); // Constructor
|
||||||
Body(const Body& body); // Copy-constructor
|
Body(const Body& body); // Copy-constructor
|
||||||
virtual ~Body(); // Destructor
|
virtual ~Body(); // Destructor
|
||||||
|
|
||||||
Kilogram getMass() const; // Return the mass of the body
|
Kilogram getMass() const; // Return the mass of the body
|
||||||
void setMass(Kilogram mass); // Set the mass of the body
|
void setMass(Kilogram mass); // Set the mass of the body
|
||||||
|
bool getIsMotionEnabled() const; // Return if the rigid body can move
|
||||||
|
void setIsMotionEnabled(bool isMotionEnabled); // Set the value to true if the body can move
|
||||||
|
bool getIsCollisionEnabled() const; // Return true if the body can collide with others bodies
|
||||||
|
void setIsCollisionEnabled(bool isCollisionEnabled); // Set the isCollisionEnabled value
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Inlines function --- //
|
// --- Inlines function --- //
|
||||||
|
@ -53,11 +59,31 @@ inline Kilogram Body::getMass() const {
|
||||||
return mass;
|
return mass;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Return if the rigid body can move
|
||||||
|
inline bool Body::getIsMotionEnabled() const {
|
||||||
|
return isMotionEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the value to true if the body can move
|
||||||
|
inline void Body::setIsMotionEnabled(bool isMotionEnabled) {
|
||||||
|
this->isMotionEnabled = isMotionEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
// Method that set the mass of the body
|
// Method that set the mass of the body
|
||||||
inline void Body::setMass(Kilogram mass) {
|
inline void Body::setMass(Kilogram mass) {
|
||||||
this->mass = mass;
|
this->mass = mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if the body can collide with others bodies
|
||||||
|
inline bool Body::getIsCollisionEnabled() const {
|
||||||
|
return isCollisionEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the isCollisionEnabled value
|
||||||
|
inline void Body::setIsCollisionEnabled(bool isCollisionEnabled) {
|
||||||
|
this->isCollisionEnabled = isCollisionEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,12 +42,10 @@ namespace reactphysics3d {
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
class RigidBody : public Body {
|
class RigidBody : public Body {
|
||||||
private :
|
protected :
|
||||||
Matrix3x3 inertiaTensorLocal; // Local inertia tensor of the body (in body coordinates)
|
Matrix3x3 inertiaTensorLocal; // Local inertia tensor of the body (in body coordinates)
|
||||||
BodyState currentBodyState; // Current body state
|
BodyState currentBodyState; // Current body state
|
||||||
BodyState previousBodyState; // Previous 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
|
|
||||||
double interpolationFactor; // Interpolation factor used for the state interpolation
|
double interpolationFactor; // Interpolation factor used for the state interpolation
|
||||||
double restitution; // Coefficient of restitution (between 0 and 1), 1 for a very boucing body
|
double restitution; // Coefficient of restitution (between 0 and 1), 1 for a very boucing body
|
||||||
OBB obb; // Oriented bounding box that contains the rigid body
|
OBB obb; // Oriented bounding box that contains the rigid body
|
||||||
|
@ -65,8 +63,6 @@ class RigidBody : public Body {
|
||||||
BodyState& getPreviousBodyState(); // TODO : DELETE THIS
|
BodyState& getPreviousBodyState(); // TODO : DELETE THIS
|
||||||
void setInterpolationFactor(double factor); // Set the interpolation factor of the body
|
void setInterpolationFactor(double factor); // Set the interpolation factor of the body
|
||||||
BodyState getInterpolatedState() const; // Compute and return the interpolated state
|
BodyState getInterpolatedState() const; // Compute and return the interpolated state
|
||||||
bool getIsMotionEnabled() const; // Return if the rigid body can move
|
|
||||||
void setIsMotionEnabled(bool isMotionEnabled); // Set the value to true if the body can move
|
|
||||||
void setLinearVelocity(const Vector3D& linearVelocity); // Set the linear velocity of the rigid body
|
void setLinearVelocity(const Vector3D& linearVelocity); // Set the linear velocity of the rigid body
|
||||||
double getRestitution() const; // Get the restitution coefficient
|
double getRestitution() const; // Get the restitution coefficient
|
||||||
void setRestitution(double restitution); // Set the restitution coefficient
|
void setRestitution(double restitution); // Set the restitution coefficient
|
||||||
|
@ -125,16 +121,6 @@ inline void RigidBody::setInterpolationFactor(double factor) {
|
||||||
interpolationFactor = factor;
|
interpolationFactor = factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return if the rigid body can move
|
|
||||||
inline bool RigidBody::getIsMotionEnabled() const {
|
|
||||||
return isMotionEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the value to true if the body can move
|
|
||||||
inline void RigidBody::setIsMotionEnabled(bool isMotionEnabled) {
|
|
||||||
this->isMotionEnabled = isMotionEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the linear velocity of the rigid body
|
// Set the linear velocity of the rigid body
|
||||||
inline void RigidBody::setLinearVelocity(const Vector3D& linearVelocity) {
|
inline void RigidBody::setLinearVelocity(const Vector3D& linearVelocity) {
|
||||||
// Update the linear velocity of the current body state
|
// Update the linear velocity of the current body state
|
||||||
|
|
Loading…
Reference in New Issue
Block a user