I am developing a FPS game and I want to have bullets drop over distance and actually take time to travel but I don’t want to use rigidbodies because they’re too unreliable for detecting collisions.
In my head I have thought maybe I could take the angle that the weapon fires at and use that with an algorithm of some sort that will give me points along the trajectory that I can fire rays at different angles along with collision detection. I’m unsure however how I could accomplish this.
Could I have the rays fire at different points and time until there is a collision detected so the bullet doesn’t travel instantly but also not miss any collisions?
That’s basic calculus (which means it’s not really calculus.) Estimate the curve by doing lots of little straight lines. The official math term for this is the “shooting method.”
The “bullet” would be just a set of numbers – position, and x,y,z speed. Maybe spawn a bullet empty with that script. Each frame move the bullet forward and add gravity, then raycast from start to end. Then decide you want to do that in three steps/per frame (move 1/3rd, add 1/3 gravity, three times.)
If you do it adding gravity before the move (always a little too low,) then again adding after (always a little too high,) you bracket the real value, so can play with steps/frame until the error is tiny.
May as well add the wind, as long as you’re doing all that work.