-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KinematicCharcaterController
: the up vector cannot point downward
#413
Comments
I think this is fine, just missed an .abs() for the loosening so should be a simple fix. |
Okay this seems to work, thank you. The game no longer crashes when I set the Where am I supposed to put the #[inline]
fn loosened(&self, amount: Real) -> Aabb
assert!(amount.abs() >= 0.0, "The loosening margin must be positive.");
Aabb {
mins: self.mins + Vector::repeat(-amount),
maxs: self.maxs + Vector::repeat(amount),
}
} And this causes a new issue: the player is not blocked by the floor when the |
Try adding the abs before the assert like |
I still have the same problem. #[inline]
fn loosened(&self, amount: Real) -> Aabb {
let amount = amount.abs();
assert!(amount >= 0.0, "The loosening margin must be positive.");
Aabb {
mins: self.mins + Vector::repeat(-amount),
maxs: self.maxs + Vector::repeat(amount),
}
} |
It wouldn't be the same thing the mins would be constrained not loosened if it was negative. |
Of course, my bad. I was focused on the |
Hello, I'm working on a game where I can reverse gravity. By doing that, I need to be able to switch the direction of the
up
vector of theKinematicCharcaterController
so that it points downward.But as soon as I set the up vector to
Vec2::new(0.0, -1.0)
the game crashes, stating that "The loosening margin must be positive" (parry2d is throwing this error message).For your information, the same problem occurs if I set the up vector to
Vec2::new(-1.0, 0.0)
.I don't know if it's intended but because of that, I cannot manage to have the
grounded
property of theKinematicCharcaterControllerOutput
to betrue
when the player touches the "ground" once the gravity is reversed.Here is a small example illustrating the issue, just change the
up
attribute of theKinematicCharacterController
component toVec2::NEG_Y
and the game will crash (bevy_rapier2d version used : v0.22.0):The text was updated successfully, but these errors were encountered: