Anyone have a simple new gun tutorial?

The place to discuss all things Receiver.
Post Reply
MikeyB
Posts: 5
Joined: Mon Sep 30, 2013 9:24 pm

Anyone have a simple new gun tutorial?

Post by MikeyB » Mon Sep 30, 2013 9:46 pm

Hi all, I just found this game, and it is simply STUNNING! I love everything about it, mainly the mechanics. This game now allows me to explore my modeling and animation imagination for all my previous and new models. I can do this just fine, my only issue is getting it running and playing in unity! Can anyone post a simple tutorial on how to get it in unity (ive already got the source from the repository and loaded it into unity but now im confused)? I would really love some support on this as many others probobly would too. Thank you all in the mean time!

User avatar
Josh707
Posts: 123
Joined: Sun Jan 22, 2012 3:09 pm
Location: Canada

Re: Anyone have a simple new gun tutorial?

Post by Josh707 » Tue Oct 01, 2013 1:39 am

It's not exactly simple but it's not too difficult either. Well, depending on how the weapon you're adding operates you might not need to do any programming, but that limits what you can add. I'll try to explain it briefly as I'm about to go to bed (I'm assuming you're familiar with Unity).

First make sure you've opened 7DFPS-master/UnityProject instead of just 7DFPS-master, then load the scene called scene. You'll have to replicate the prefabs for the other guns but with your model. If it operates the same as the Colt, you will have to have the same manipulable parts in the same hierarchy with the same names, as they're just read by script. So your gun would be something like this, I can't remember the actual names but they're similar:

Gun
-slide
-hammer
-trigger
-pose_reload
-pose_slide_pull
-point_recoil_rotate
-point_mag_inserted
And a few other ones

The other gun prefabs are just in the Objects folder. The gun object itself, the parent of the entire gun, only has GunScript and an audio source attached for all the sound variables, the two enums gun_type and action_type define how the gun works, for example I had to add a pump-action action type as it doesn't have a slide lock or an external hammer. The magazine is a separate prefab which by default is filled with rounds, the renderers are toggled to simulate it emptying. The magazine prefab only has mag_script, an audio source and a collider. The variables on both scripts are self-explanatory.

You then have to make another prefab, the name doesn't matter but call it yourgun_holder for consistency. The gun_holder has the weapon_holder script attached, it has 4 variables for the prefabs you made, the gun, magazine, round casing and casing with the bullet. After all that is made, you have to select the gui_skin_holder object that is by default an object in the scene, increase the weapons array size in the only script attached, and then add yourgun_holder to that array. It randomly chooses from that list, so you can either set it in the Start() function of GUISkinHolder.js or make that array only include your gun for testing.

Also, the parent of the entire gun hierarchy should be level with the weapons sights, that's where it places the gun by default. Sorry if I worded this poorly, I'm about to go to bed. Feel free to ask any questions, I'm really bad at explaining things.

MikeyB
Posts: 5
Joined: Mon Sep 30, 2013 9:24 pm

Re: Anyone have a simple new gun tutorial?

Post by MikeyB » Tue Oct 01, 2013 7:22 pm

Hi Josh707,

First of all, wow, thank you for such a detailed and thoughtful reply, i didnt expect that! I am going to try what you said first before I report back to you with questions (i need to fail first so i know what im doing wrong XD). I am going to do another shotgun, but a trench gun from ww2, I want to see all the mechanics in it work and i think it would work beautifully with the games mechanics. Again thank you so much for the prompt reply, very much appreciated!!!

Sincerely,
Mikey B

MikeyB
Posts: 5
Joined: Mon Sep 30, 2013 9:24 pm

Re: Anyone have a simple new gun tutorial?

Post by MikeyB » Tue Oct 01, 2013 9:16 pm

Hi Josh707,

I just finished a rough model of my ww2 trenchgun (im not going to skin or anything like that yet). I have one question, do I animate my gun in say my modeling program? For instance, do i animate each part in one big sequence like start with the pump on my shotgun for a certain amount of frames, then reloading, then loading, then cock pump back to front, etc. Or, do I put my model into unity and use unity to animate my model? I am going to put joints and animate my gun in my program in the meantime waiting for a reply back! Thanks man!

User avatar
Josh707
Posts: 123
Joined: Sun Jan 22, 2012 3:09 pm
Location: Canada

Re: Anyone have a simple new gun tutorial?

Post by Josh707 » Wed Oct 02, 2013 12:22 am

No problem! And no you actually don't need to do any animating at all, it's all done with empty gameobjects as target positions. The positions are just the empty game objects you see such as point_slide_back and stuff.

MikeyB
Posts: 5
Joined: Mon Sep 30, 2013 9:24 pm

Re: Anyone have a simple new gun tutorial?

Post by MikeyB » Wed Oct 02, 2013 5:33 pm

Hey man,

For some reason im struggling so hard to figure out how to perform these steps. Im used to making my own FPS from scratch using unity's built in libraries and such and I do it a really different way than what Wolfire has done. I love the fact that you are trying to explain this too me but im not getting it for some reason. Is there any way that I can get you to show me a overview video of the steps you take? I believe i have my model all ready to go (theres only `5 different parts on it) but im struggling to understand. Can i send you an email with my .FBX file of my gun? my email is [email protected]. Thanks again man, if you cant thats cool too!!

User avatar
Josh707
Posts: 123
Joined: Sun Jan 22, 2012 3:09 pm
Location: Canada

Re: Anyone have a simple new gun tutorial?

Post by Josh707 » Wed Oct 02, 2013 7:46 pm

MikeyB wrote:Hey man,

For some reason im struggling so hard to figure out how to perform these steps. Im used to making my own FPS from scratch using unity's built in libraries and such and I do it a really different way than what Wolfire has done. I love the fact that you are trying to explain this too me but im not getting it for some reason. Is there any way that I can get you to show me a overview video of the steps you take? I believe i have my model all ready to go (theres only `5 different parts on it) but im struggling to understand. Can i send you an email with my .FBX file of my gun? my email is [email protected]. Thanks again man, if you cant thats cool too!!
Yeah there's a few things you need to have right when adding the gun, it has to be pointing in the right direction by default and have 1,1,1 scale and stuff. I really don't feel like making a video but I can try to see if your model will work, my email is [email protected] if you want me to try. I'll try and let you know if anything needs to be changed, and if not I'll try to explain the steps I took in more detail.

Post Reply