How to shoot a bullet in a trajectory for a sniper gun.

Basically the straight line approach that I am using at the moment just is not realistic for sniper shooting. How would I go about shooting a bullet that would say travel over 1000 metres and drop accordingly.

2 Answers

2

Well after only using Unity for a week and not being a great programmer the actual implementation in Unity is something I think someone else will answer far better than me. What I can tell you though is that I am trying to do a similar thing and I have found the following which were useful.

http://www.hornady.com/ballistics-resource

http://www.globalsecurity.org/military/library/policy/army/fm/23-10/index.html

These sites give you the equations and theory that you need but they are not exactly simple ones mind.

As for implementation in Unity read here: http://unity3d.com/support/documentation/Components/class-Rigidbody.html

Apply a TrailRenderer to the Rigidbodys and you get a tracer ammunition effect. Very nice :-)

I agree with Ende. If you need to factor in elements like wind, you can also use AddForce and AddTorque that are available in the RigidBody class.

Sniper you say? Is it possible if you can give me the stuff needed for a zoom in? Ive made a assault rifle with a scope on the top. Not much point being there if you cant even zoom in. Much appreciated

if you want to zoom you can change the fieldOfView of the camera

Thank you so much! That script worked just fine and it loads alright. It is so odd that my original script wasn't working since I just copied it from my other project, and it worked fine. Thanks again!