Hi,
I'm just starting with Havok so apologies if this is a dumb question, I'm sure I'm overlooking something simple or doing things the wrong way but I've tried everyting I can think of and am still having the same issues.
Anyway, I'm trying to make a 3rd person flight game where the spaceships are flying over a planet surface and are subject to gravity using Havok linking to Ogre for the graphics rendering. I have all this set up so the Ogre mesh produces a rigidBody in Havok and the ship falls under gravity and can be pitched, yawed and moved forward under thrust. The issue I'm having is that there seems to be a limiter on the speed the ship will travel, it accelerates to a certain speed to start with and then no matter how much I increase the thrust it doesn't seem to go any faster. The code I'm using is below:
void PlayerShip::update(Real elapsedTime, OIS::Keyboard *input) {
//apply thrust
mHkWorld->lock();
bearing = hkVector4(0, 0, 1);
hkTransform trans = mBody->getTransform();
hkRotation currRot = trans.getRotation();
bearing.setRotatedDir(currRot, bearing);
bearing.mul(thrust);
mBody->applyLinearImpulse(bearing);
mHkWorld->unlock();
if (input->isKeyDown(OIS::KC_P)) {
if (thrust < 2500)
thrust += 5;
}
if (input->isKeyDown(OIS::KC_L)) {
if (thrust > 5)
thrust -= 5;
}
if (input->isKeyDown (OIS::KC_W)) {
mHkWorld->lock();
hkVector4 rot = hkVector4(1, 0, 0);
hkTransform trans = mBody->getTransform();
hkRotation currRot = trans.getRotation();
rot.setRotatedDir(currRot, rot);
rot.mul(1000000);
mBody->applyTorque(elapsedTime, rot);
mHkWorld->unlock();
}
// All other keys, S, A, D, perform a rotation as above but in a different direction
As you can see I'm having to multiply my applyTorque values by huge amounts to get any real rotation so I wonder whether this is anything to do with my problem? Also, the models I am using to produce my Rigid Bodyare scaled up to be around 8 times the size of a real life object (They are from the Ogre tutorial and are the best I have at the moment) soI didn't know if this could also be an issue, although I have given my ship a very low mass of 1000 / 8 (as its 8 times the size of what it should be using SI units).
Hopefully I've given enough information for someone to have a crack at what my issue might be but if not please let me know and I can happily post more detail.
Cheers!


