Hallo mein Name ist Andreas,
ich habe Probleme mit meiner Kamera:
Ich möchte sie in 90° Schritten drehen, also
wenn ich zum Beispiel die Taste "l" drücke.
Ich bekomme wohl eine Kamera hin die sich frei bewegt, aber keine
die immer hinter dem Player bleibt auch wenn Sie gedreht wird.
Ich meine damit das, wenn ich die Kamera drehe auch der Player in
die Richtung rollt wie die Kamera schaut.
das habe ich bis jetzt...
Code:
....
ball_speed.y = 25 * (key_cuu - key_cud); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
phent_addtorqueglobal (ball, ball_speed); // add a torque (an angular force) to the ball
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
var dist_planar = 300; // distance from the player
var cam_angle = 0;
var dist_total = 300; // Change THIS value to zoom in or out
var tilt_3rd = 0;
{
dist_planar = cos (tilt_3rd) * dist_total;
camera.x = ball.x - cos (cam_angle) * dist_planar;
camera.y = ball.y - sin (cam_angle) * dist_planar;
camera.z = ball.z + sin (tilt_3rd) * dist_total + 60;
camera.pan = cam_angle;
camera.roll = 0;
camera.tilt = -tilt_3rd;
if(key_d==1)
{
camera.z = ball.z + 30;
camera.tilt -=30;
camera.z = ball.z + 300;
}
}
...
Wäre nett wenn mir damit Jemand weiterhelfen könnte, danke!