How to fire a GUN?

I was hoping someone could help with a popular aspect of gaming I cant figure out or get my brain wrapped around the concept of firing a gun?

There are many types of guns, machine (fast small bullets), powerful guns (slower but still fast like fireballs), lasers (longer electric type very cool).

I wrote the Unity Forums looking for information on how it all works and received one response from someone else’s post:


Generally its best to make bullets from guns that shoot small fast bullets, which you can’t really see cause of the speed (can’t remember but i think those types of guns actually have a category name) instant hit using raycasts as it will lower the overhead considerably compared to moving a gameobject using physics. To get the effect of bullets with mass hitting objects like you have on the crates you can just add a some force to the object that was hit by the ray cast. For laser or grenade kinda things i would go with particles and a raycast for lasers and objects for grenades.

The raycast API is found here:


Unfortunately I have no idea what the above post means ( even though I really appreciate the response)

I’d really like to learn how to do all of these types but I just cant figure it out? Id be happy with learning how to do a slow glowing bullet just to get on the correct learning path but in the end I have to learn them all.

So I’m desperately seeking your help!

Do you have any insight as to how this all works because it seems like there are a few different techniques depending on what type of gun firing you want to do. I was thinking mainly animation with a little scripting which id love to learn even though scripting hurts my brain lol.

Anyway Unity Is an awesome tool which is a very user friendly game application The Best I Have Ever Seen!

I just wish I could learn faster :slight_smile:

Sincerely,
Michael

P.S. I finally got my Mac and Unity :slight_smile:

Hi Michael,

this link should get you started.

http://unity3d.com/support/documentation/Manual/Instantiating%20Prefabs.html

Hello R.A.E,

Thank you very much for the response and a step in the right direction :slight_smile:

I’ve been playing around with this for hours now and I kind feel like im chasing my tail lol. For some reason I just cant grasp this or Im doing something wrong? in the process.

Is there any way you could send me a project example that I could pick apart and see whats going wrong?

I know its a lot to ask but I need the help, and maybe someday I can return the favor.

Sincerely,
Michael
mcarr.1973@yahoo.com

Unfortunatly I can not give you project, since i dont have one yet.I saw a post in the forum one day where they had a shooterproject added. Try searching for it or maybe someone here knows the link.

In the wiki is a 2D shooter tutorial by Eric.
http://www.unifycommunity.com/wiki/index.php?title=2DShooter

and here a post about it

http://forum.unity3d.com/viewtopic.php?t=8451

very appreciated R.A.E :slight_smile: :slight_smile: :wink:

Thank You.