top of page

Day 36: Weapon Modelling...Part 2

Part 2:


My plan for the day:

I wanted to continue working from where I left off yesterday, which was creating a weapons slot script and adding in the models. Today, I created another script for the player inventory and adjusted the sword prefab to fit the character's hands. What I accomplished:

I started off by creating a script called WeaponItem, that would store all the future weapons and loading and unloading them. For now, they would only be used for the dual swords. Once the scripting for the player inventory was done, it was time to position the swords on the hands. They would load into the character's hands, but all over the place and not in the right direction. To correct this, I started off by creating an empty game object for only the left sword called weapon override, which will make sense later. To correct the position of the sword on the right, I entered play mode and adjusted the position of the weapon pivot of the right hand sword. Once that was done, I copied the transform of the pivot, and exited play mode, and opened up the weapon model prefab. I then pasted these transform values into the weapon pivot there, and that corrected the right hand sword. I could not repeat this for the left hand sword however, since adjusting the weapon pivot values now would also affect the right hand sword. That is why I had created the weapon override, which would basically by the pivot of the left hand sword. I went into play mode and adjusted the values of the left hand override, and copied those values and put that into the weapon pivot not in the prefab. In this way, I got both swords to adjust to the correct places, while using only 1 gameobject.


______________________________________________________________________________________________________



ree

Image Source: The Unity game

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page