Skip to content

Commit

Permalink
Added aerodynamic drag
Browse files Browse the repository at this point in the history
  • Loading branch information
JunePrimavera committed Sep 4, 2023
1 parent 3884363 commit 8576cfa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/io/github/teampropulsive/physics/Aero.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.teampropulsive.physics

import io.github.teampropulsive.types.AtmoCompositionGas
import net.minecraft.util.math.Vec3d

class Aero {
fun calculate_aero(velocity : Vec3d, drag_coefficient : Double, area_in_direction : Double, atmo : ArrayList<AtmoCompositionGas>): Vec3d {
var average_density = 0.0;
for (gas in atmo) {
average_density += gas.gas.density * gas.quantity
}
average_density /= atmo.size.toDouble()
val force = velocity.multiply(velocity).multiply(average_density).multiply(0.5).multiply(drag_coefficient).multiply(area_in_direction)
return force
}
}

0 comments on commit 8576cfa

Please sign in to comment.