git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@190 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
5489b3db18
commit
0624c33c28
|
@ -26,9 +26,8 @@
|
|||
using namespace reactphysics3d;
|
||||
|
||||
// Constructor
|
||||
BodyState::BodyState(const Vector3D& position, const Matrix3x3& inertiaTensorInverse, const Kilogram& massInverse)
|
||||
: position(position), orientation(Quaternion(0,1,0, 0.0)), inertiaTensorInverse(inertiaTensorInverse), massInverse(massInverse) {
|
||||
// TODO : orientation will be initialized in another way
|
||||
BodyState::BodyState(const Vector3D& position, const Quaternion& orientation, const Matrix3x3& inertiaTensorInverse, const Kilogram& massInverse)
|
||||
: position(position), orientation(orientation), inertiaTensorInverse(inertiaTensorInverse), massInverse(massInverse) {
|
||||
|
||||
// Recalculate the secondary values from the primary values
|
||||
recalculate();
|
||||
|
@ -92,5 +91,5 @@ Vector3D BodyState::computeForce(Time time) const {
|
|||
// Return the torque on the body at time
|
||||
Vector3D BodyState::computeTorque(Time time) const {
|
||||
// TODO : Implement this method
|
||||
return force + Vector3D(0.0, 0.0 ,0.0);
|
||||
return Vector3D(0.0, 0.0 ,0.0);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class BodyState {
|
|||
Kilogram massInverse; // Inverse of the mass of the body
|
||||
|
||||
public :
|
||||
BodyState(const Vector3D& position, const Matrix3x3& inertiaTensorInverse, const Kilogram& massInverse); // Constructor
|
||||
BodyState(const Vector3D& position, const Quaternion& orientation, const Matrix3x3& inertiaTensorInverse, const Kilogram& massInverse); // Constructor
|
||||
BodyState(const BodyState& bodyState); // Copy-constructor
|
||||
virtual ~BodyState(); // Destructor
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ void OBB::draw() const {
|
|||
glVertex3f(s6.getX(), s6.getY(), s6.getZ());
|
||||
|
||||
glVertex3f(center.getX(), center.getY(), center.getZ());
|
||||
glVertex3f(center.getX() + 8.0 * axis[1].getX(), center.getY() + 8.0 * axis[1].getY(), center.getZ() + 8.0 * axis[1].getZ());
|
||||
glVertex3f(center.getX() + 8.0 * axis[2].getX(), center.getY() + 8.0 * axis[2].getY(), center.getZ() + 8.0 * axis[2].getZ());
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
|
|
@ -24,16 +24,20 @@
|
|||
using namespace reactphysics3d;
|
||||
|
||||
// Constructor
|
||||
RigidBody::RigidBody(const Vector3D& position, const Kilogram& mass, const Matrix3x3& inertiaTensor, const OBB& obb)
|
||||
RigidBody::RigidBody(const Vector3D& position, const Quaternion& orientation, const Kilogram& mass, const Matrix3x3& inertiaTensor, const OBB& obb)
|
||||
: Body(mass), inertiaTensor(inertiaTensor), obb(obb),
|
||||
currentBodyState(position, inertiaTensor.getInverse(),Kilogram(1.0/mass.getValue())),
|
||||
previousBodyState(position, inertiaTensor.getInverse(), Kilogram(1.0/mass.getValue())) {
|
||||
currentBodyState(position, orientation, inertiaTensor.getInverse(),Kilogram(1.0/mass.getValue())),
|
||||
previousBodyState(position, orientation, inertiaTensor.getInverse(), Kilogram(1.0/mass.getValue())) {
|
||||
|
||||
isMotionEnabled = true;
|
||||
isCollisionEnabled = true;
|
||||
interpolationFactor = 0.0;
|
||||
|
||||
// Set the body pointer to the OBB
|
||||
this->obb.setBodyPointer(this);
|
||||
|
||||
// Update the orientation of the OBB according to the orientation of the rigid body
|
||||
this->update();
|
||||
}
|
||||
|
||||
// Copy-constructor
|
||||
|
|
|
@ -49,7 +49,7 @@ class RigidBody : public Body {
|
|||
OBB obb; // Oriented bounding box that contains the rigid body
|
||||
|
||||
public :
|
||||
RigidBody(const Vector3D& position, const Kilogram& mass, const Matrix3x3& inertiaTensor, const OBB& obb); // Constructor
|
||||
RigidBody(const Vector3D& position, const Quaternion& orientation, const Kilogram& mass, const Matrix3x3& inertiaTensor, const OBB& obb); // Constructor
|
||||
RigidBody(const RigidBody& rigidBody); // Copy-constructor
|
||||
virtual ~RigidBody(); // Destructor
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user