movement of the aircraft

Started by EagleAlex, October 31, 2012, 08:29:34 AM

Previous topic - Next topic

EagleAlex

I try to create the engine of the aircraft (game) and all went well until moment when I had to move the plane a bit in the other direction. I need to rotate the nose of the plane and fly down there where he was looking ,but the plane went in the coordinates X ie forward as she possibly could if I had not turned. Tell me how can I make the plane fly out where to turn.

Rotation carries out
if (move_left) {
model.rotateY(-0.01f);
}
if (move_right) {
model.rotateY(0.01f);
}

Moving backward/forward
if (move_backward) {
model.translate(v.x, v.y, v.z+speed);
}
if (move_forvard) {
model.translate(v.x, v.y, v.z-speed);
}


private void move() {
SimpleVector v = model.getZAxis();
SimpleVector s = model.getYAxis();
SimpleVector t = model.getXAxis();

if (forward) {
camZ-=5;
}

if (backward) {
camZ+=5;
}
if (move_left) {
model.rotateY(-0.01f);
}
if (move_right) {
model.rotateY(0.01f);
}
if (move_backward) {
model.translate(v.x, v.y, v.z+speed);
}
if (move_forvard) {
model.translate(v.x, v.y, v.z-speed);
}
if (fly_up) {
model.translate(s.x, s.y-speed, s.z);
}
if (fly_down) {
model.translate(s.x, s.y+speed, s.z);
}
if (to_vertical) {
model.translate(t.x+speed , t.y , t.z);
}
if (to_horizontal) {
model.translate(t.x-speed , t.y , t.z);
}
}

EgonOlsen

I'm not sure if i get the problem...try to rotate around the axis returned by getYAxis() instead of doing a rotateY. Maybe that helps...