quote:
Originally posted by HJPuhlmann:
key_cur und key_cul für rechts und links .....
Am bestem mal ins Handbuch schauen.
Wo steht das im Handbuch, kannste mir ma die Seite sagen ??
Ich hab´s jetzt so gemacht:
code:
force.Y = strength.Y*(key_cul -key_cur );
Das Problem is, wenn ich jetzt eine der Tasten drücke, dann dreht sich der Player nur, is ja auch so vorher eingestellt. Wie kann ich dass ausstellen, das der sich dann dreht ? Hier is noch ma die function, ich hab schon ma geguckt, hab aber nix gefunden.
code:
function _player_intentions()
{
// Set the angular forces according to the player intentions
aforce.PAN = -astrength.PAN*(KEY_FORCE.X+JOY_FORCE.X);
aforce.TILT = astrength.TILT*(KEY_PGUP-KEY_PGDN);
if(MOUSE_MODE == 0)
{ // Mouse switched off?
aforce.PAN += -astrength.PAN*MOUSE_FORCE.X*mouseview*(1+KEY_SHIFT);
aforce.TILT += astrength.TILT*MOUSE_FORCE.Y*mouseview*(1+KEY_SHIFT);
}
aforce.ROLL = 0;
// Set ROLL force if ALT was pressed
if(KEY_ALT != 0)
{
aforce.ROLL = aforce.PAN;
aforce.PAN = 0;
}
// Double the forces in case the player pressed SHIFT
/*-- if(KEY_SHIFT != 0)
{
aforce.PAN += aforce.PAN;
aforce.TILT += aforce.TILT;
aforce.ROLL += aforce.ROLL;
}--*/
// Limit the forces in case the player
// pressed buttons, mouse and joystick simultaneously
limit.PAN = 2*astrength.PAN;
limit.TILT = 2*astrength.TILT;
limit.ROLL = 2*astrength.ROLL;
if(aforce.PAN > limit.PAN) { aforce.PAN = limit.PAN; }
if(aforce.PAN < -limit.PAN) { aforce.PAN = -limit.PAN; }
if(aforce.TILT > limit.TILT) { aforce.TILT = limit.TILT; }
if(aforce.TILT < -limit.TILT) { aforce.TILT = -limit.TILT; }
if(aforce.ROLL > limit.ROLL) { aforce.ROLL = limit.ROLL; }
if(aforce.ROLL < -limit.ROLL) { aforce.ROLL = -limit.ROLL; }
// Set the cartesian forces according to the player intentions
force.X = strength.X*(KEY_FORCE.Y+JOY_FORCE.Y); // forward/back
force.Y = strength.Y*(key_cul -key_cur ); // side to side
force.Z = strength.Z*(KEY_HOME-KEY_END); // up and down
if(MOUSE_MODE == 0)
{ // Mouse switched off?
force.X += strength.X*MOUSE_RIGHT*mouseview;
}
// Double the forces in case the player pressed SHIFT
/*-- if(KEY_SHIFT != 0)
{
force.X += force.X;
force.Y += force.Y;
force.Z += force.Z;
}--*/
// Limit the forces in case the player tried to cheat by
// operating buttons, mouse and joystick simultaneously
limit.X = 2*strength.X;
limit.Y = 2*strength.Y;
limit.Z = 2*strength.Z;
if(force.X > limit.X) { force.X = limit.X; }
if(force.X < -limit.X) { force.X = -limit.X; }
if(force.Y > limit.Y) { force.Y = limit.Y; }
if(force.Y < -limit.Y) { force.Y = -limit.Y; }
if(force.Z > limit.Z) { force.Z = limit.Z; }
if(force.Z < -limit.Z) { force.Z = -limit.Z; }
}