Added support for gravity change
This commit is contained in:
parent
b5631457d3
commit
462413b527
|
@ -139,6 +139,12 @@ void SimpleRigidBody::SetAngularFactor(Float factor)
|
|||
this->rigidBody->setAngularFactor(factor);
|
||||
}
|
||||
|
||||
void SimpleRigidBody::SetGravity(Float3 gravity)
|
||||
{
|
||||
this->rigidBody->setGravity(btVector3(gravity.x, gravity.y, gravity.z));
|
||||
this->gravity = gravity;
|
||||
}
|
||||
|
||||
void SimpleRigidBody::SetUpAndRight(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 right)
|
||||
{
|
||||
btTransform trans;
|
||||
|
@ -167,7 +173,6 @@ void SimpleRigidBody::SetUpAndForward(::Oyster::Math::Float3 up, ::Oyster::Math:
|
|||
rotation[1] = upVector.normalized();
|
||||
rotation[2] = forwardVector.normalized();
|
||||
rotation[0] = forwardVector.cross(upVector).normalized();
|
||||
|
||||
trans = this->rigidBody->getWorldTransform();
|
||||
trans.setBasis(rotation);
|
||||
this->rigidBody->setWorldTransform(trans);
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace Oyster
|
|||
void SetRotation(Math::Float3 eulerAngles);
|
||||
void SetAngularFactor(Math::Float factor);
|
||||
|
||||
void SetGravity(Math::Float3 gravity);
|
||||
|
||||
void SetUpAndRight(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 right);
|
||||
void SetUpAndForward(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 forward);
|
||||
|
||||
|
@ -51,6 +53,7 @@ namespace Oyster
|
|||
void* GetCustomTag() const;
|
||||
|
||||
private:
|
||||
|
||||
btCollisionShape* collisionShape;
|
||||
btDefaultMotionState* motionState;
|
||||
btRigidBody* rigidBody;
|
||||
|
@ -61,6 +64,8 @@ namespace Oyster
|
|||
EventAction_Move onMovement;
|
||||
|
||||
void *customTag;
|
||||
|
||||
::Oyster::Math::Float3 gravity;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,6 +139,8 @@ namespace Oyster
|
|||
virtual void SetRotation(::Oyster::Math::Float3 eulerAngles) = 0;
|
||||
virtual void SetAngularFactor(::Oyster::Math::Float factor) = 0;
|
||||
|
||||
virtual void SetGravity(::Oyster::Math::Float3 gravity) = 0;
|
||||
|
||||
virtual void SetUpAndRight(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 right) = 0;
|
||||
virtual void SetUpAndForward(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 forward) = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue