In Webaverse creativity’s the name of the game. Whether you want to create avatars, vehicles or weapons, we’ve got you covered. To create custom weapons, the process isn’t much different from creating vehicles or pets.

Ranged vs Melee Weapons:

In Webaverse, there are two types of weapons: Ranged and Melee. Ranged weapons include all type of guns or other weapons that shoot a projectile. Melee weapons include all types of swords and other weapons that have the ability to damage objects. For the purposes of this tutorial, the only configuration difference will be the starting point.

For Ranged weapons, start with the Pistol template: https://github.com/webaverse/pistol

For Melee weapons, start with the Sword template: https://github.com/webaverse/sword

image_2022-02-19_011501.png

  1. Go to the GitHub template repo (listed above) and fork it to your personal account.

pistol.png

  1. Add your own .glb model into the repo —- Or just use one of the existing models that’s already there.
  2. Next, open the .metaversefile (or index.js for the Pistol repo) and edit it.

pistol22.png

  1. Search the file for “.glb” ***and update the reference from “.glb” to the name of the model you want to use (i.e., **“mymodel.glb” ). ****Then save and commit the changes. For more information about .metaversefile, look here.

pistol2233.png

  1. Your model is now ready to be used in any Webaverse scene! There’s just one last step required in order to reference it from a hosted Webaverse installation: enable the GitHub Page on your repo. Head over to the settings for the repo, go to the Pages section, set the branch as master and save it. Finally, make a note of the GitHub page URL for later.

bandicam 2022-02-19 01-47-33-422.mp4

  1. You can use any of our template scenes or make your own. To add a model in a template scene, go the “app/scenes” folder in your cloned Webaverse app and open any of the .scn files.
  2. Copy and paste this into the .scn file right before the closing “]” bracket.
,{
	"position": [
		0,
		2,
		0
	],
	"quaternion": [
		0,
		0,
		0,
		1
	],
	"start_url": "<https://webaverse.github.io/pistol/>"
}
  1. You can also adjust the starting position and rotation of the model based on where you want it in your scene. Now save the file and you’re good to go. Run the app, enter the edited scene and enjoy!

Checkout our tutorial on how to create a weapon:

bandicam 2022-02-26 19-38-17-645.mp4