-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support arbitrary raycasting into a Scene #2401
Comments
This looks like a good approach to me! The only other suggestions I might have is some way to filter out by collision groups. I might want to just raycast against a "floor" group, for example. That could either be an option passed to the raycast (the collision group/name), or if there's a way to get all colliders from a collision group I could cross-reference them with the hitResults (though that could involve a lot of iterating). |
Good point, maybe this where we can pass an optional option bag with the various configurations? const floorGroup = ex.CollisionGroupManager.create("floor");
scene.physicWorld.rayCast(ray, {
maxDistance: 100,
collisionGroups: [floorGroup]
}) |
@eonarheim I like that! |
TODO: * [ ] TileMaps aren't working yet * [ ] Tests
This issue hasn't had any recent activity lately and is being marked as stale automatically. |
Closes #2401 This PR implements an arbitrary raycasting api in Excalibur ```typescript const hits = engine.currentScene.physics.rayCast(new ex.Ray(player.pos, ex.Vector.Down), { maxDistance: 100, collisionGroup: blockGroup, searchAllColliders: false }); ``` <img width="797" alt="image" src="https://user-images.githubusercontent.com/612071/178625499-d9f97052-5b18-49fe-9440-89bd93e46ff6.png"> ## Changes: - Fix issue where TileMaps weren't correctly added to the collider data structure - Add physics world with raycasting endpoint
Context
Currently you must have a reference to a collider in order to perform a raycast against it, this quickly becomes slow, unwieldy, or impractical if a scene has many colliders.
Proposal
Add a way off of scene to raycast arbitrarily and get results
Possible sketch
The text was updated successfully, but these errors were encountered: