I’m generating some procedural meshes based on a collision layer in my tilemap. The mesh seems to be generated correctly (as far as I can tell), but my raycasts won’t hit it. If I attach a ‘collisionstart’ event to the player object, it definitely hits the mesh. Its just the raycast that’s failing.
The relevant raycast code is in scripts/player.js and the mesh is being generated in scripts/LDtk.js in the parseCollisionLayer anonymous function.
I wondered about that too, but unless there’s something weird going on with how the entities are parented/layered, everything should have a z value of 0.
There’s definitely something weird going on, I tried manually casting a ray from a high z to a low z value directly “through” the mesh and its still not hitting. I may just have to bite the bullet and use a 3D camera controller script to view the mesh from all sides once its been generated.
Maybe have the raycast at a 90 degree angle to the map, and have another entity to spawn the raycast at a certain point, maybe a point that follows player?
Switching to p2 is giving me much better results! I still need to tinker with some things to get it all working properly, but I think that may be the solution for me. Thanks for suggesting that, it didn’t even occur to me to just use a non-3D library…