Projecting a shape along an axially-aligned direction onto a segment. |
tl;dr: Most of my work last week revolved around adding more support for oddly-shaped surfaces.
What happened last week?
Highlights
- Continued adding support for oddly-shaped surfaces.
Laundry list
- Continued adding support for oddly-shaped surfaces:
- Refactor calculate-surface-from-collision logic.
- This used to assume that all surfaces lie along axially-aligned tile-map cell boundaries.
- Now that I’m trying to reincorporate support for oddly-shaped tiles, this isn’t going to work!
- I also used to have this split into two separate parts:
- Calculate tile-map-coordinates from collision.
- Calculate surface from tile-map-coordinates.
- But in order to get more-accurate results, I actually need to check for surface-existence when calculating the tile-map-coordinate in the first place.
- So I’ve now combined both the tile-map-coordinate and surface calculation into a single function.
- Fix floor-max-angle epsilon.
- This needed to be larger.
- Godot's collision-detection system is not always super accurate.
- Fix surface-calculation edge-cases for angled surfaces.
- Add support for tracking surface-contact normals.
- Test using surface-normals when applying min-velocity to maintain surface collisions.
- When a character is attached to a surface, I need to always apply some velocity into the surface, otherwise Godot won't report that the character is still touching the surface.
- However, now that I have non-axially-aligned surfaces, I needed to make this velocity happen in the direction of the contacted segment.
- Add support for ignoring invalid Godot collisions during surface-state updates.
- Godot's collision-detection system generates a lot of bogus collision normals.
- I needed to make my system a little more robust to handling these invalid results.
- Update get_slide_collision usage to consider adjusted collision normals if none of the collisions were valid.
- Reconcile velocity-application-to-maintain-collisions with the move_and_slide_with_snap API.
- The sequence of events was wrong.
- My velocity values weren't actually getting used correctly, and surface-contacts were breaking.
- Remove legacy logic for maintaining collisions.
- Disable snap-to-surface and maintain-surface-collision when jumping or releasing surface.
- Fix issues with snap-to-non-floor-surface.
- Cancel horizontal velocity when colliding with a ceiling that slopes against the direction of motion.
- Implement better drawing single-vertex annotations.
- Start implementing better non-axially-aligned and segmented-surface annotations.
- Implement better surface-segment drawing, so that adjacent segments align even as they get deeper, and for any angle of either surface.
- My previous surface drawing logic assumed all surfaces were axially-aligned, and didn't look good with odd surface angles.
- Start adding support for calculating trajectories along oddly-shaped surfaces.
- Previously, my intra-surface-edge and climb-to-adjacent-surface-edge trajectories were calculated assuming that adjacent surfaces form a 90-degree angle.
- This causes some problems for oddly-shaped surfaces:
- Expected edge durations and distances were wrong.
- The paths drawn when preselecting a destination were inaccurate and distracting.
- Edge-playback for climb-around-adjacent-surface-edges were pushing the character into the surface, while the collision-system pushed the character out of the surface, and the character ended up getting stuck going back and forth.
- I implemented a function for projecting a shape along an axially-aligned surface-normal direction until it lies against the surface.
- project_shape_onto_surface
- project_shape_onto_segment
Projecting a circle onto a line segment in an axially-aligned direction.
|
- Miscellaneous:
- Add support for `move_and_slide_with_snap` instead of `move_and_slide`.
- In the end, I actually removed this support after all.
- Godot's surface-snapping is too limited for me; it only works on floors.
- And I already have all the tools I need to implement my own version that works at least as well.
- Record a space_state reference on Su.
- This is an object that I need to reference when using some of Godot's collision detection APIs.
- Previously, I was just re-accessing this in lots of different places.
- Remove rounding-corner-actions, since they are no longer needed for snapping the character position to the corner.
- Maintain a custom copy of active collisions, and concatenate into this the collisions from the separate calls to move_and_slide in `_apply_movement` and `_maintain_collisions`.
- Refactor match-expected-edge-trajectory to be a function on SurfacerCharacter instead of an action-handler.
- This gives the benefit of being able to now offset the character according to surface and character shape after updating the position to match the edge.
- Because updating the expected edge position to be more accurate for oddly-shaped surfaces is much harder to do.
- Add an extra metadata flag to FailedEdgeAttempt, to enable recreating the appropriate fall-from-floor-edge-attempt calculations.
- Add an optional `basis_edge` parameter to `calculate_edge` in order to enable recreating the appropriate fall-from-floor-edge calculations.
- Fix FallFromFloorEdge to save/load fall-off state in the platform-graph files.
- Fix a bug with maintaining both floor and wall collisions at the same time.
- Fix a bug where maintain-collision was preventing climbing from wall to concave ceiling.
- Move logic for forcing character trajectory to match expected navigation from navigator to character.
- Refactor collider-shape-rotation-logic to store and reference is_rotated_90_degrees rather than recalculating it.
- Remove obsolete snap_to_surface_vector.
- Refactor shape/rotation/half-width-height/is-rotated-90-degrees logic to use a new RotatedShape data structure.
What's next?
- Finish adding support for oddly-shaped surfaces.
- Add support for parsing surfaces from multiple TileMaps.
- Add support for colinear neighbor surfaces that aren't merged together.
- This will be important for things like marking parts of a surface that have a different friction, or that can't be navigated across.
🎉 Cheers!
Comments
Post a Comment