And I still don't like what I have here. I like the bullet outline, that's handy, it also always renders on top. I like the glow effect, but I don't like how it's the entire hull, which is what's getting penetrated here, i'd rather just show the surface portion that was penetrated. I might have to see if I can dig into all the vertices and do something, or maybe just give up and play a particle effect.
Anyway, I also fixed my turret turning slightly, i'm casting a ray from the muzzle to the target and setting the rotations on the turret that way, but introduced more bugs with it, silly PzII main gun being off center turret threw off my math. I'll have to do something there, maybe even mild IK. Though I'm tempted to cheat and just move to first person mode. I still need to finish remapping the collision texture I use. I've colored about 1/3 of it, and need to go in and assign armor values for the rest. It's boring work though. I also need to clean up the end of the bullet cam, it leaves things in a messy state, and do something about the timescale I have currently set. Ideally it would do some lerping between start and target. I could just get rid of gravity entirely and do a raycast to see what gets hit, or fire a phantom bullet first at full speed to see what I hit, then use an AnimationCurve to adjust the timescale as the bullet travels.
And Unity Physics never fails to disappoint, it seems to do all sorts of weirdness. Okay, I get not handling a projectile that's travelling at 1000 m/s, but even after lowering that to 250 m/s and lowering the gravity on my shell by the 1/4 as well, in a sort of pseudo time scaling, I still get strange collision behavior. And upping the solver iteration count and lowering the Fixed Timestep doesn't completely alleviate it either, though it does make it better. I've already marked the shell as Continous and tried both Extrapolate and Interpolate.
And then there's the setting to think about. I'm trying to justify WWII tanks and some sort of X-Com or Pirates like gameplay, with the player accepting missions for different factions and controlling a small hodge podge force of two tank platoons, with possibly some support infantry, if I can swing it. (or i could try to toss the WWII trappings)
Having been working on a similar vehicle based shooter-style game prototype which also drew a lot of inspirations from WoT/WT in Unity, I can feel your pain 100%
Expecially the physics part. Man, PhysX is such a Pain in the behind.... and while the old Unity 4 version was bad, the new one is outright broken! I don't care if it runs faster when the new wheel colliders are completly useless and non-convex mesh colliders no longer work. The new PhysX trashed my motion physics (which took many days and week to tune because even the old wheel colliders where crap) and my damage system (which relied on non-convex mesh colliders to model armour zones and module hitboxes) in one go!
My Unity 5 port is now temporary laid on ice while either uPhysics delivers their newest version or I find the courage to come up with my own pseudo-physics system.... gonna test out Unreal Engine 4 in the meantime, so the time is not wasted
Turret control was also quite a problem for me but solved that.... I even have a running autoaim system that does usable pre-aiming based on the current movement vector of the target. The off center gun of my vehicle was also a problem, but I solved that with a constant (that tell the system how much off center the gun is) and a function that decreases the influence over distance. Works flawlessly for me.
I use a secondary game object for both turret and gun, all player or autoaim input manipulates this "target" game object, and each frame the actual turret and gun work towards matching this target for rotation. No need for raycasting.
If you like I can describe my solution in more detail. Its not rocket sience, just many many hours lost trying to get it working ;)
about the projectile, if you have the physics budget for it (like, you are not trying to simulate dozens of vehicles on a small mobile chip), forget about colliders for the projectile... use raycasts. Calculate how far the projectile will fly in a frame (or use a good estimate), calculate the arc of the flightpath (or again, use a good estimate), use the latter to adjust the ray direction (so you get an approximation of the actual ballistic trajectory over many frames), and the former to decide how long your ray should be.
Let me tell you, once the formulas to calculate it are correct, your collisions will work 100% accurate... its not even that worse a hit for performance, as the rays you shoot every frame are quite short.
And yes, I tried it with up to 950 m/s muzzle velocity, works fine.
Speaking about performance, just because this was the biggest performance hog for me and I only found out after a year:
Don't INSTANCIATE and DESTROY anything. Ever. Especially not projectiles you fire out at multiple shots per second. Create your own pooling system, precreate the projectiles (as many as you need) at startup, cycle through the pool while firing, setting projectiles that hit something or reached max distance to inactive and return them to the pool to be fired again.
You will see a MASSIVE decrease in FPS loss when firing an automatic weapon this way.
Hope this helps