cannon.js
cannon.js copied to clipboard
simulating bullets
I'd like to create bullets that fly but ray-cast ahead of them in their velocity direction. My question is that if a bullet flies to far and enters a body then I send a ray will it still return the body that I am inside of or must I ray-cast back and see if I overshot the body.
My next question is it computationally expensive to ray-cast each frame of every projectile especially if there are a lot of projectiles on screen at a time in the case of a machine gun or shotgun.
This I believe could be an elegant way to write continuous collision detection onto a projectile.