Custom Guns: Difference between revisions

From Pavlov VR Wiki
Jump to navigation Jump to search
No edit summary
(Halfway Done)
 
(14 intermediate revisions by the same user not shown)
Line 11: Line 11:
1)  Importing assets
1)  Importing assets


2) Edit the assets
2) Edit the physics assets


3)  Edit the skeleton asset
3)  Edit the skeleton asset
Line 26: Line 26:


They can be imported like any other meshes. The gun mesh is a skeletal mesh while the rest are normal static meshes.
They can be imported like any other meshes. The gun mesh is a skeletal mesh while the rest are normal static meshes.
[[File:CustomGunsSetup1.png|left|thumb|479x479px|Example for the AK47]]


[[File:CustomGunsSetup1.png|alt=Example for the AK47|frameless|538x538px]]


The bone names for the gun mesh can be anything, but it's good practice to follow the format above.


== Editing the physics asset ==
Open up your physics mesh and enable primitives and all bones in the top right arrow.
[[File:CustomGunsSetup2.png|thumb|400x400px|none]]it should like like this after in the skeleton tree:
[[File:CustomGunSetup3.png|frameless|335x335px]]


Now that we can see what we're working with, we can add our primitives.


We do this by right clicking on the b_gun_Root bone and "Add Shape" then "Add Box"


[[File:CustomGunSetup4.png|frameless|562x562px]]


Make multiple of these until you can cover them up like below:


[[File:CustomGunSetup5.png|frameless|561x561px]]


Click on any of the added shapes and make sure "Simulation Generates Hit Events" is set to true for the primitives in the details panel over on the right.           


This is to make sure the weapon plays sounds when dropped and colliding with something.


The bone names for the gun mesh can be anything, but it's good practice to follow the format CustomMapTools/PavExamples/Guns/M4/SK_M4v2_Skeleton.uasset
[[File:CustomGunSetup6.png|frameless|797x797px]]
 
Now we can work on adding the sockets to our skeleton for the gun blueprint to use.
 
== Editing the skeleton asset ==
Open the skeleton asset for your gun mesh or click the skeleton icon in the top right of the physics asset:
 
[[File:CustomGunSetup7.png|frameless]]Right click on the root bone and add the following sockets: Magazine, MagInsert, ShellEjectionSocket, Muzzle, and Suppressor.
 
[[File:CustomGunSetup8.png|frameless|402x402px]]
 
Right click on the charging handle bone and add these two sockets: Chamber, ChargingHandle
 
Should look similar to this when you're done:
 
[[File:CustomGunSetup9.png|frameless]]
 
Add a preview asset to the magazine socket by right clicking on it, then going to "Add preview asset" and selecting the magazine mesh.
 
[[File:CustomGunSetup10.png|frameless|560x560px]]
 
The magazine mesh should be attached to the Magazine socket, move the socket so that the preview mesh is in the right place:
 
[[File:CustomGunSetup11.png|frameless|579x579px]]Do the same for the MagInsert socket. Move the MagInsert socket to where the insert animation should start like above.
 
Now we can setup the Muzzle/ Suppressor sockets.
 
Move them to the end of the gun, the Muzzle socket sits at the end of the barrel while the Suppressor socket needs to be a little bit in the barrel.
 
Add a preview asset to get the Suppressor socket in the right place.
 
The rotation of the Muzzle socket does matter, it needs to be X-facing like the image below:

Latest revision as of 12:16, 29 April 2023

Imhttps://mod.io/g/pavlov/r/custom-gun-guide

If you are simply adding a premade custom weapon then most will come with a guide on how to, this guide is not for you.

Before making a custom gun you must be setup, in order to set up you will need to follow the steps below.

Setup to making a Custom Gun

In order to make a custom gun you will need to do 4 things.


1) Importing assets

2) Edit the physics assets

3) Edit the skeleton asset

4) Create the animation BP


You're expected to know some Unreal Engine basics.

Importing Assets

When importing assets it should be known that you will usually have 5 main assets to create a custom gun: gun mesh, magazine mesh (full and empty), shell casing (full and empty).

They can be imported like any other meshes. The gun mesh is a skeletal mesh while the rest are normal static meshes.

Example for the AK47

The bone names for the gun mesh can be anything, but it's good practice to follow the format above.

Editing the physics asset

Open up your physics mesh and enable primitives and all bones in the top right arrow.

CustomGunsSetup2.png

it should like like this after in the skeleton tree:

CustomGunSetup3.png

Now that we can see what we're working with, we can add our primitives.

We do this by right clicking on the b_gun_Root bone and "Add Shape" then "Add Box"

CustomGunSetup4.png

Make multiple of these until you can cover them up like below:

CustomGunSetup5.png

Click on any of the added shapes and make sure "Simulation Generates Hit Events" is set to true for the primitives in the details panel over on the right.

This is to make sure the weapon plays sounds when dropped and colliding with something.

CustomGunSetup6.png

Now we can work on adding the sockets to our skeleton for the gun blueprint to use.

Editing the skeleton asset

Open the skeleton asset for your gun mesh or click the skeleton icon in the top right of the physics asset:

CustomGunSetup7.pngRight click on the root bone and add the following sockets: Magazine, MagInsert, ShellEjectionSocket, Muzzle, and Suppressor.

CustomGunSetup8.png

Right click on the charging handle bone and add these two sockets: Chamber, ChargingHandle

Should look similar to this when you're done:

CustomGunSetup9.png

Add a preview asset to the magazine socket by right clicking on it, then going to "Add preview asset" and selecting the magazine mesh.

CustomGunSetup10.png

The magazine mesh should be attached to the Magazine socket, move the socket so that the preview mesh is in the right place:

CustomGunSetup11.pngDo the same for the MagInsert socket. Move the MagInsert socket to where the insert animation should start like above.

Now we can setup the Muzzle/ Suppressor sockets.

Move them to the end of the gun, the Muzzle socket sits at the end of the barrel while the Suppressor socket needs to be a little bit in the barrel.

Add a preview asset to get the Suppressor socket in the right place.

The rotation of the Muzzle socket does matter, it needs to be X-facing like the image below: