Jump to content

Making a gun from scratch


Angelwolf
 Share

Recommended Posts

Hello Everyone!

 

So I'm looking to make a gun from scratch.

 

From what I'm aware, these are the steps:

 

Make a model, export as FBX

Add to Leadwerks scene

Add empty box as child to model within Leadwerks

Add Gun script to model

Save as prefab

Set prefab to player start weapon

 

However, I have tried this and I can't get it working. Is there a guide or tutorial on this?

Link to comment
Share on other sites

If I add my model, add the gun script, save as prefab and try to use as a weapon, it doesn't show on the FPS player when in game.

 

I though the empty box was required as I'd read this on forums before. Essentially to act as a bone, or linking point (apparently).

Link to comment
Share on other sites

It took me a bit, remember to add a pivot to the end of the barrel named 'pivot'. Look at the example pistol that comes with leadwerks. Then it's on to adjustment hell as you try to align the gun with your view perfectly, save as prefab, remove your extra gun in the scene so it doesn't crash and make sure your gun prefab is attached to your model. Something like that.

  • Upvote 1
Link to comment
Share on other sites

Okay, so here's where I'm at with this.

 

I have loaded the model.

I have added the FPS gun script and tweaked the offset and rotation to have it match my player.

I have added a pivot to the end of the barrell called 'muzzle'.

 

The gun now loads, is in view, and can shoot (Hooray!)

 

However, I have one final problem now. I can't seem to reload it. Given I am simply using a model for this with no animations, I am assuming that it's mandatory to use a reload animation with it?

 

Any way to bypass this?

 

E; Turns out I was right, it needs to have a reload animation. I have one in Blender but can't work out how to export it properly. When the model is imported into Leadwerks, it sees that there are keyframes but the model doesn't actually animate. I'm sure it's a problem with Blender not exporting properly but God only knows what settings are actually needed there.

Link to comment
Share on other sites

Animation shaders are supplied.Click on the animated models material and in the material editor

and look in shaders folder for animation shader.

 

Thank you!

 

Turns out that this, combined with the animations themselves, were the problem.

 

For anyone trying to export their model from Blender, you need to go to the Dope Sheet, set to Action Manager then add a new animation, click the 'F', make your animation with keyframes, then export. You also need at least one bone armature.

 

When exported, the material must be applied with the before mentioned animation shader.

 

Maybe Ill do a video tutorial on this one day when Ive got the knack of it, to help out others.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...