Basically I am attempting to make a "space sim" sort of thing just to test, see if I can do it, unfortunately I am running into some minor niggles. I am not very maths based, I am translating my camera behind my ship like so:
Code: Select all
vector3df hi = swordNode->getPosition();
aabbox3d<f32> oO = swordNode->getBoundingBox();
vector3df* r = new vector3df[8];
oO.getEdges(r);
hi = r[1];
hi += (r[5] / 2);
camera->setPosition(hi);
camera->setTarget(swordNode->getPosition());
delete r;
and then I am translating it based on changes in ship rotation with euler stuff..specifically:
Code: Select all
vector2df calcMatrix(vector2df inputs,f32 change)//inputs are X and Y
{
vector2df outputs = vector2df(0,0);
change *= ((f32)PI / (f32) 180.0);
f32 cosRes = cos(change);
f32 sinRes = sin(change);
if(change < 0)
{
outputs.X = (cosRes * inputs.X) - (sinRes * inputs.Y);
outputs.Y = (sinRes * inputs.X) + (cosRes * inputs.Y);
}
else
{
if(change == 0)return outputs;
outputs.X = (cosRes * inputs.X) + (sinRes * inputs.Y);
outputs.Y = -(sinRes * inputs.X) + (cosRes * inputs.Y);
}
return outputs;
}
Now as I said, I am not very maths based and as such have probably screwed up in some if not all of this. Butttt what I am wondering, in this environment what is the best way to create movement in a 3D environment in peoples opinions? Is it best to use say a physics engine and forces (Which I tried to do and failed miserably with irrOde irrNewt and many many others... Have been stuck for a while now

or to actually do it yourself for the movement. or alternatively can someone give me some example code or logical progression of how I might accomplish 3d movement? (and yes I have looked at multiple maths sites, and books in a vain attempt to grasp exactly what is going on)
Just to add. What I am trying to do is take rotation aka D key rotates one degree right, now I want to move in that direction when W key is pressed.
But the cage only had "Warning: Vicious Lions" on it! Im a programmer! I only listen to errors!