Hi everybody,
(First of all, this is not related to the Bullet physics engine! However I can’t seem to change the name of a thread…)
recently, i was trying to integrate a crossbow into my game. All working fine ( ), only that when shooting my arrow/bolt at any mesh or terrain collider, the very fast (±100 m/s) rigidbody projectile would just pass right through. I’ve been working with unity for quite some years now, but this kind of bug keeps on occuring frequently, if not almost always.
I’ve done some research on the forums and found out, that most people avoid this problem using rayscasting or increasing the collider bounds of the projectile. Adding a larger collider was not an option for me, so I tried raycasting. Then again, I don’t get the ballistic flight curve/trajectory the projectile would actually follow. That was not an option either, so I came up with this. Since there seems to be no similar project on the forums (most of them just shoot in a straight line, thus ignoring gravity’s effets on the projectile):
Bullet Physics v1.0:
It took me about a day to set the whole thing up, test it and fix many bugs, but now it’s all working.
This system simulates the trajectory of a bullet or any fast moving small projectile using several raycasts along the flight curve of an actual rigidbody bullet. To make sure that there’s a delay between the moment you shoot and the impact, several rays are cast at regular intervals along the curve. All you need to do is enter the muzzle velocity of your gun, the muzzle and the gun itself. Your gun calls a function from the bullet physics script which then does all the dirty work for you.
So, what do you get from that? Correct bullet drop, bullet travel time and real troube hitting a moving target
If you happen to have any questions, problems, bugs or whatever, feel free to contact me or ask right here on the forums.
PS: Read the READ ME file for further information on how to use.
Download:
Project: Click here
Package: Cick here