question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Unexpected intersection values in precollision event

See original GitHub issue

I 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:

CleanShot 2022-09-03 at 18 30 45@2x

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:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mattjenningscommented, Sep 7, 2022

@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!

1reaction
eonarheimcommented, Sep 4, 2022

@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 šŸ‘

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a Post-Collision Braking System and How Does It Work?
When a vehicle is in a collision, the crash event does not always end at impact. The physical laws around momentum dictate that...
Read more >
Signalized Intersections: Informational Guide, August 2004
Selecting a candidate intersection using a combined collision frequency/collision rate method ... Chi-square test values and corresponding confidence levels.
Read more >
LEXUS SAFETY SYSTEM+
When the Pre-Collision System with Pedestrian Detection determines that the possibility of a frontal collision with that vehicle is high, it prompts the...
Read more >
2023 Toyota Tundra Manuals & Warranties | Toyota Owners
Intersection right/left turn assistance (pre-collision braking) When the turn signal lights are not flashing, support for turning left or right at anĀ ...
Read more >
(PDF) Initial Driver Avoidance Behavior and Reaction Time to ...
Subjects in the shortest, most severe collision avoidance situation were significantly ... unexpected and unalerted intersection incursion.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found