Collision detection without physics component

Screenshot%20from%202018-04-18%2009-44-04

Hello,
when I add shooter to the scene, I have a question about collision detection.

Before , there are no physics in scene , I adjust the position and rotation of character by simple calculation.
And hit cube by Ray-cast from camera.

But now I want to shoots bullets, how I to detection the collision between bullet and other character.
Do I have to use physics component ?

I’m pretty sure you could just use a raycast for that as well (I couldn’t tell you exactly how, but it should be the same as finding the cubes).

yes , the raycast can find node . but the bullet is fly , I want know when the bullet hit on the character.

If you want to avoid using physics you can just calculate the bullets trajectory for that frame and repeat each frame, updating the position accordingly (basically doing your own physics calculations for a point particle).

OK, then , for check collision , should I check if the bullet’s position in the interior of character node every frame?

No, unless it’s traveling very slowly - you also need to catch when the bullet passes fully through the character in one frame, hence the raycast. If you wanted, you could do it just by adding a few trigger physics components to the characters as well, though you might still want to use a ray or sphere cast if the bullets will be covering a lot of ground in one frame. Personally, if probably just use the graphics raycast, though.

1 Like

Thanks for the help, :slight_smile:

1 Like