Increase glider aspect ratio and remove inline tweaks

This commit is contained in:
Ludvig Böklin 2021-04-24 19:59:51 +02:00
parent df8b18903b
commit 93ce593c62
7 changed files with 10 additions and 19 deletions

2
Cargo.lock generated
View File

@ -5473,7 +5473,6 @@ dependencies = [
"hashbrown",
"image",
"indexmap",
"inline_tweak",
"lazy_static",
"num-derive",
"num-traits",
@ -5574,7 +5573,6 @@ version = "0.9.0"
dependencies = [
"hashbrown",
"indexmap",
"inline_tweak",
"ordered-float 2.1.1",
"rand 0.8.3",
"rayon",

View File

@ -15,7 +15,7 @@ default = ["simd"]
[dependencies]
common-base = { package = "veloren-common-base", path = "base" }
inline_tweak = "1.0.8"
# inline_tweak = "1.0.8"
# Serde
serde = { version = "1.0.110", features = ["derive", "rc"] }

View File

@ -146,7 +146,8 @@ impl Body {
if ar > 25.0 {
panic!(
"Aerodynamic lift calculation does not work for aspect ratios \
> 25"
> 25. Either decrease span length or increase chord length. \
The formula for AR is `span^2 / (pi * span/2 * chord/2)`"
);
};
// Oswald's efficiency factor (empirically derived--very magical)
@ -275,11 +276,10 @@ fn angle_of_attack(ori: &Ori, rel_flow_dir: &Dir) -> f32 {
pub fn lift_coefficient(aspect_ratio: f32, planform_area: f32, aoa: f32) -> f32 {
let aoa_abs = aoa.abs();
let stall_angle = PI * 0.1;
inline_tweak::tweak!(1.0)
* planform_area
planform_area
* if aoa_abs < stall_angle {
lift_slope(aspect_ratio, None) * aoa
} else if inline_tweak::tweak!(true) {
} else {
// This is when flow separation and turbulence starts to kick in.
// Going to just make something up (based on some data), as the alternative is
// to just throw your hands up and return 0
@ -294,8 +294,6 @@ pub fn lift_coefficient(aspect_ratio: f32, planform_area: f32, aoa: f32) -> f32
// let's just say lift goes down linearly again until we're at 90°
Lerp::lerp(c_l_max, 0.0, (aoa_abs - deg_45) / deg_45) * aoa_s
}
} else {
0.0
}
}

View File

@ -55,8 +55,8 @@ impl CharacterBehavior for Data {
mv_dir.y,
Lerp::lerp_unclamped(
0.0,
data.inputs.look_dir.z + inline_tweak::tweak!(0.3),
mv_dir.magnitude_squared() * inline_tweak::tweak!(2.0),
data.inputs.look_dir.z + 0.3,
mv_dir.magnitude_squared() * 2.0,
),
)
})

View File

@ -27,11 +27,7 @@ impl CharacterBehavior for Data {
.try_change_by(-energy_cost, EnergySource::Glide)
.is_ok()
{
update.character = CharacterState::Glide(glide::Data::new(
inline_tweak::tweak!(10.0),
inline_tweak::tweak!(1.0),
*data.ori,
));
update.character = CharacterState::Glide(glide::Data::new(10.0, 0.6, *data.ori));
} else {
update.energy.set_to(0, EnergySource::Glide);
update.character = CharacterState::Idle;

View File

@ -31,4 +31,4 @@ slab = "0.4.2"
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control", "derive"], rev = "5a9b71035007be0e3574f35184acac1cd4530496" }
# Tweak running code
inline_tweak = { version = "1.0.8", features = ["release_tweak"] }
# inline_tweak = { version = "1.0.8", features = ["release_tweak"] }

View File

@ -81,8 +81,7 @@ fn integrate_forces(
// Hydrostatic/aerostatic forces
// modify gravity to account for the effective density as a result of buoyancy
let down_force =
dt.0 * inline_tweak::tweak!(1.0) * gravity * (density.0 - fluid_density.0) / density.0;
let down_force = dt.0 * gravity * (density.0 - fluid_density.0) / density.0;
vel.0.z -= down_force;
vel