-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Hello again :) I've been using your awesome port for a bit and ran into this issue.
When using space SegmentQuery and the space is setup to use a spatial hash the engine will crash due to:
github.com/jakecoffman/cp.(*SpaceHash).SegmentQuery(0x3f91111111111101?, {0x97a100?, 0xc000694690?}, {0x4077700000000000?, 0x3ff0000000000000?}, {0x3fb999999999999a?, 0x0?}, 0x9?, 0x0?, {0x0?, ...})
C:/Users/beebl/go/pkg/mod/github.com/jakecoffman/[email protected]/spacehash.go:239 +0x5d1
github.com/jakecoffman/cp.(*Space).SegmentQuery(0xc0006ac000, {0x3f91111111111111?, 0x7dcf65?}, {0x1ddec26e158?, 0x40?}, 0x4014000000000000, {0x0?, 0x8?, 0x1ddec210a20?}, 0x9d73f0, ...)
C:/Users/beebl/go/pkg/mod/github.com/jakecoffman/[email protected]/space.go:1046 +0x216
This is because SpaceHash::SegmentQuery is expecting the obj interface to be an instance of Shape and not SegmentQueryContext which is passed into it by shape::SegmentQuery.
I suspect this is broken with the other query functions as well, but I haven't had time to check.
The workaround is to not configure a spatial hash.
I'm not sure if I need to use a spacial hash or not, but I need to support a few thousand collision objects in my project. I'll not use the spatial hash for now.
Here is a small example of the problem and you may comment out the line that sets up the spatial hash to see segment query does work in that case:
https://gist.github.com/steampoweredtaco/ecf8aa13ba26d4cad7e54962bc1453d7