moveWithCollisions and hitTestView with SolidRects and Collision.SHAPE is broken.
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 148
- Avg merge
- 13h 44m
- Merged PRs (30d)
- 1
Description
`moveWithCollisions` does not impede movement upon a collision. This is because[ the line](https://github.com/korlibs/korge/blob/821a3b09f7ec6978af8e8338b36573ed7958dddd/korge/src/commonMain/kotlin/com/soywiz/korge/view/HitTestable.kt#L147)
```
if (collision.all { it == this || it.hitTestView(char) == null }) {
```
Always resolves as true.
in fact `hitTestView` never resolves as true with 2 views that are obviously colliding.
## Workaround:
```
moveWithHitTestable(walls.toHitTestable(),dx,dy)
```
Works as expected.
Contributor guide
No contributing guide indexed for this repository
Research direction
Read korge/src/commonMain/kotlin/com/soywiz/korge/view/HitTestable.kt around line 147, then compare moveWithCollisions with the moveWithHitTestable workaround described in the issue. Reproduce the collision using SolidRects and Collision.SHAPE, and consider the work complete when hitTestView detects the collision and movement is impeded as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100