mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Minor control over velocity when in the air
This commit is contained in:
@ -106,6 +106,8 @@ impl Body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn air_accel(&self) -> f32 { self.base_accel() * 0.025 }
|
||||||
|
|
||||||
/// Attempt to determine the maximum speed of the character
|
/// Attempt to determine the maximum speed of the character
|
||||||
/// when moving on the ground
|
/// when moving on the ground
|
||||||
pub fn max_speed_approx(&self) -> f32 {
|
pub fn max_speed_approx(&self) -> f32 {
|
||||||
@ -245,11 +247,12 @@ pub fn handle_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
|||||||
fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||||
handle_orientation(data, update, efficiency);
|
handle_orientation(data, update, efficiency);
|
||||||
|
|
||||||
if let Some(accel) = data
|
let accel = if data.physics.on_ground {
|
||||||
.physics
|
data.body.base_accel()
|
||||||
.on_ground
|
} else {
|
||||||
.then_some(data.body.base_accel() * efficiency)
|
data.body.air_accel()
|
||||||
{
|
} * efficiency;
|
||||||
|
|
||||||
// Should ability to backpedal be separate from ability to strafe?
|
// Should ability to backpedal be separate from ability to strafe?
|
||||||
update.vel.0 += Vec2::broadcast(data.dt.0)
|
update.vel.0 += Vec2::broadcast(data.dt.0)
|
||||||
* accel
|
* accel
|
||||||
@ -259,7 +262,6 @@ fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
|||||||
let fw = Vec2::from(update.ori);
|
let fw = Vec2::from(update.ori);
|
||||||
fw * data.inputs.move_dir.dot(fw).max(0.0)
|
fw * data.inputs.move_dir.dot(fw).max(0.0)
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles forced movement
|
/// Handles forced movement
|
||||||
|
Reference in New Issue
Block a user