Skip to content
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

Raycasting support #9

Closed
vveisard opened this issue Jun 21, 2021 · 4 comments
Closed

Raycasting support #9

vveisard opened this issue Jun 21, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@vveisard
Copy link

Raycasting would be an excellent addition and within scope of the package.

@Prozi
Copy link
Owner

Prozi commented Aug 8, 2021

what user api would you have in mind

it is quite easy to implement:

this is how I would do this: (not tested)

  • create a temporary line (2 point polygon),
  • add to system,
  • check line's potentials using BVH,
  • iterate over potentials to check exact collisions,
  • add collisions to array,
  • select closest point to start of array,
  • remove temporary line from system.

regards

@Prozi Prozi added the enhancement New feature or request label Apr 13, 2022
@Prozi
Copy link
Owner

Prozi commented Apr 18, 2022

@sineprime what would you expect from such Raycasting api ?

what example function names / functionalities would you want to have ?

@Prozi
Copy link
Owner

Prozi commented Apr 18, 2022

I've decided to keep it simple and went with

system.raycast(start: Vector, end: Vector): { point: Vector; collider: TBody } | null

and included it inside the tank test demo https://prozi.github.io/detect-collisions/demo/

@Prozi
Copy link
Owner

Prozi commented Apr 18, 2022

closing as working

available since v3.5.0

@Prozi Prozi closed this as completed Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants