Unexpected intersection values in precollision event
See original GitHub issueI apologize for the vague title, but Iām not too sure how to succinctly explain this one š
Below is a clip of logging ev.intersection
in the precollision
event for the red actor. It has a passive collider, while the green walls are fixed. It seems that when the red actor is colliding near the bottom 10% of the green actor, the intersection stops populating x
and instead populates y
.
(the laggy console logging is just codesandbox being slow)
https://user-images.githubusercontent.com/8703090/188290360-01a15255-5a2d-4915-84e0-66100099d322.mp4
Hereās a bit more context showing how I initially ran into this:
This is essentially a makeshift raycast. There are 8 of these āraysā, one on for each corner, doing the same precollision
event checking. For debugging purposes, when any of them detect a precollision they are colored red. I then use the intersection
values to determine the distance to the collision. So the horizontal colliders will use x
, and vertical y
. As you can see, the horizontal bottom-right corner suffers from this issue, as the x
value is 0 for its intersection.
Itās possible I am abusing this intersection value for something itās not meant to be used for. #2410 is likely going to be the better solutionā¦ but this is actually working quite well otherwise!
Is there a reason only x
or y
are populated, and not both? Perhaps it would be better if they were?
Steps to Reproduce
https://codesandbox.io/s/excalibur-collision-intersection-bug-x26fug?file=/index.js
Expected Result
The x
value of the intersection should continue to be the populated value.
Actual Result
The x
value stops being populated and instead y
is.
Environment
- browsers and versions: Chrome 105
- operating system: macOS 12.5
- Excalibur versions: 0.27
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top GitHub Comments
@eonarheim hmm I seeā¦ I think I understand. Unfortunately the suggested workarounds arenāt going to work for me but I know Iām sort of pushing the boundaries of this approach anyway. I can wait for the raycasting and see how well that works in its place!
@mattjennings Definitely seems like a bug to me, very unexpected.
Iāll dig in and see if I can figure out whatās up.
Sorry for the rough edges in collision, but I appreciate all the fixes weāve got into excalibur because of your efforts š