Stuck between projectiles and ray cast


i’m currently implementing wapon system for a mobile 3d shooter project
it seems that ray trace is cheaper than using projectiles but projectiles and their physics are great
when i think to a 3d shooter seems to me that projectiles are the way to go…
but optimization is foundamental
is it doable using projectiles with physics for a mobile 3d shoot’em up?

more i don’t have so much experience in firing using ray cast,in the end it’s just a line trace with a particle system attached to it?


any chance to have an answer or at least some links?
i couldn’t find precise documentation about this

Take a look at this tutorial :slight_smile:

the problem is that in this kind of game,3d shoot’em up,you need to see the projectiles,ball of energy ,lasers…whatever you shoot
it cannot be an instant hit,you need to see those to be able to hit the enemies
so in the end i have to spawn "something"that follows the line trace
first i don’t know well…should be this a mesh?a particle system?
so even after this,is it still cheaper than use projectiles?

edit:i just realized i wrote 3d shooter as genre of my game…wrong,instead i’m working on a 3d shoot’em up,you know you move a spaceship and billions of enemy ships shoot at you…camera is behind the ship and full free 3d movement is possible

Light (laser beam) travels at some 186,000 miles per second. That translates to a really, really fast particle or mesh that stretches from its origin point (barrel of gun) to its destination (impact point). The engine, while quite powerful, may miss a thing or two calculating what is collided with when moving that fast.

That situation may (read: WILL) require a line trace. Spawn your laser particle system along the trace line to simulate a laser.

A missile generally travels at around 200 miles per hour, quite a bit slower than a laser beam. The engine can and will calculate any and all collisions this missile has within the collision channels it is checking.

This situation may use a mesh/particle/what-have-you.

thank you for your patience.
so a mix of the different systems…intersting :slight_smile:
i might use projectiles for things like missiles
in case i want to just use a mesh,do i have to work on overlap and simple collision only?that’s all?
or a particle system with a simple collision shape around it?

what i still miss is if there a particular way to tie a particle system to a trace line or do i just have to spawn the particle system from the origin to the trace hit?
i’m naturally suspicious when things are too easy :slight_smile:

There is a laser eye tutorial live feed from a couple of years ago where someone made two circular meshes and had them expand out from the eyes, forward until they hit something. A bit of a roundabout way to do it, but fairly clever in its uses.

found 2 of them!
if anyone is intersted

again,thank you