Physics - Game Development

  • Coordinates
    • Position
      • player_p = player_p + player_dp * dt + player_ddp * dt * dt + .5f;
    • Velocity
      • player_dp = player_dp + player_ddp * dt;
    • Acceleration
      • float player_ddp = 0.f;
    • De-Acceleration
      • player_ddp -= player_dp * 10.f;
  • Collision
      // Player Position, Player Half Size, Arena Size
      if (player_p + arena_half_size_y > arena_half_size_y) {
        player_p = arena_half_size_y - player_half_size_y;
        player_dp = 0;
      }
      else if (player_p - arena_half_size_y < -arena_half_size_y) {
        player_p = -arena_half_size_y + player_half_size_y;
        player_dp = 0;
      }
    
Share: