Open UndefinedBHVR opened 3 months ago
Current noteworthy issues:
let (velocity_normalized, length) = Dir3::new_and_length(velocity).unwrap();
, might be fixed with a close to zero check instead of a zero checkCharacter slides down non-steep slopes.
This is because right now, apply_gravity
applies downward velocity even when standing on the ground. This is problematic both because of this issue and because when the character walks off a cliff it immediately starts falling down at a very high velocity instead of a gradually increasing gravitational force.
When a Grounded
check is added to apply_gravity
like this:
fn apply_gravity(
time: Res<Time>,
mut controllers: Query<(&ControllerGravity, &mut CharacterController, Option<&Grounded>)>,
) {
for (gravity, mut character_controller, grounded) in &mut controllers {
if grounded.is_some() && character_controller.velocity.y < 0.0 {
character_controller.velocity.y = 0.0;
} else {
character_controller.velocity += gravity.0 * time.delta_seconds();
}
}
}
And the ShapeCaster
ground checking component's with_max_time_of_impact(0.2)
is changed to 0.05
in order to have a more reasonable gap between the character capsule and the ground, this no longer happens.
Since Grounded
is only added when standing on a slope that doesn't exceed max_slope_angle
, this retains the sliding down on slopes that are too steep.
The downside of this is that now when walking down a slope, the character doesn't stick to it. But that can be solved by adding ground snapping logic to the collide and slide algorithm.
Accidentally pushed commit from an experiment branch, force pushed to undo it.
Objective
Solution
kinematic_character_cas_3d
.Changelog
Added
Avian Physics
channel of theBevy
discord