47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#error "Not implemented."
|
|
|
|
#if 0
|
|
const float G = 9.8f;
|
|
const float mass = 10.0f;
|
|
const float x0 = 400.0f;
|
|
const float y0 = 500.0f;
|
|
|
|
float v0 = 50.0f;
|
|
float angle = 45.0f;
|
|
float v = v0;
|
|
float x = x0;
|
|
float y = y0;
|
|
float t0 = GetTime();
|
|
|
|
vector<Vector2> trajectory;
|
|
|
|
float dt = GetTime() - t0;
|
|
v = (G/mass) * dt;
|
|
x = x0 + (v0*sin(radians(angle + 90.0f))) * dt;
|
|
y = y0 + (v0*cos(radians(angle + 90.0f)) + G*dt) * dt * v;
|
|
|
|
trajectory.push_back((Vector2) { .x = x, .y = y });
|
|
|
|
if (y > screenHeight) {
|
|
v0 = (rand() % 100) + 20.0f;
|
|
angle = rand() % 180;
|
|
v = v0;
|
|
y = y0;
|
|
x = x0;
|
|
t0 = GetTime();
|
|
trajectory.clear();
|
|
}
|
|
|
|
------
|
|
|
|
for (const auto &v : trajectory) {
|
|
DrawPixel(v.x, v.y, BLUE);
|
|
}
|
|
|
|
DrawCircleV((Vector2){x, y}, 10, RED);
|
|
|
|
DrawText("Stone Trajectory Simulation", 10, 10, 20, DARKGRAY);
|
|
DrawText(TextFormat("Time: %.2f s", dt), 10, 40, 20, DARKGRAY);
|
|
DrawText(TextFormat("Velocity: %.2f Angle: %.2f", v, angle), 10, 70, 20, DARKGRAY);
|
|
#endif
|