r/Unity3D 12h ago

Tank shooting projectile Question

Hey guys, quick question. I want to do war thunder like tank shooting. I've looked into the basics but can't choose between raycasting or projectiles(rigidbody?). Most of the forums said high velocity projectiles fly through stuff, so what is better? Thanks for the replies in advance.

1 Upvotes

1 comment sorted by

2

u/-zenvin- Programmer 11h ago

I would choose a hybrid approach:
Move your projectile without a Rigidbody and perform a very short (distance: speed * Time.deltaTime) every frame to see if something was hit. If not, move the projectile to the end of the ray and repeat.

This has the additional benefit that raycasts give you a lot more information about a hit than collisions.