-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Jumping against and over a wall sometimes causes a collision that resets velocity (Arcade Physics) #2343
Comments
I mentioned in #2344 but I think these might be related. I'm thinking a collision resolution bias towards vertical or horizontal collisions might help? Otherwise we may want to re-think the velocity solve step in the |
…ores diverging contacts (#2345) Closes #2344 #2343 This PR changes how the `ArcadeSolver` solves collisions to avoid errant collisions on seams in geometry. The idea behind this fix is to sort the collision contacts by distance. Additionally if a contact has no more overlap during processing they are now discarded so errant collisions are even evaluated. Note there are no more left right collisions in the console compared to the [sandbox](https://8wf42u.csb.app/) ![sorted-collisions](https://user-images.githubusercontent.com/612071/172401390-9e9c3490-3566-47bf-b258-6a7da86a3464.gif) This PR also fixes #2343 by ignoring "divergent contacts" which are when the underlying body's are already moving away from the contact, so no velocity adjustment is needed. This was noticeable when clipping corners, but the object was already moving out of the collision. ![cancel-velocity-fix](https://user-images.githubusercontent.com/612071/172500318-539f3a36-31ae-4efc-b6ab-c4524b297adb.gif) TODO: * [x] Look into #2343 to see if this helps * [x] Also sort by collider proximity * [x] Tests ## Changes: - Change the `Solver` from abstract class to an interface to be more flexible about solvers - Sorts contacts by body distance from each other - Cancels "divergent contacts" when the bodies are moving away from the contact
Steps to Reproduce
The above gif can be reproduced using this CodeSandbox example. (CodeSandbox is finicky with capturing key events, best to open the preview in a separate window).
Try moving the player to the right against the wall by holding the right arrow key. While still holding right, hit up to jump. Sometimes the player will slide along & above the wall, but other times it will "snap" to the top of the wall.
Expected Result
The player should slide along & above the wall
Actual Result
The player snaps to the top of the wall instead and velocity is reset - sometimes.
Environment
Current Workaround
None that I know of. I'm still quite new to using Excalibur, but this movement logic was taken from the Sample Platformer, so let me know if there's a better way to be applying velocities/collisions that might remedy this.
The text was updated successfully, but these errors were encountered: