Hi,
Someone knows how to do a Call of Duty style weapon system? Not exactly CoD system but an efficient system to use in multiplayer games because i know that you can hide the weapons and then show them when the player equips one, but this system uses too much resources if you use more than 15 different weapons and even is very difficult to keep an order if you are overlapping weapon over weapon so i want to know if there is any way to for example when the player takes a weapon from the floor or from dead enemies, the weapon destroys and instantiate another one from the same type in player hands and then set mecanim statemachine to fit that weapon animation or something similar and when the player changes weapon, it just disables render but not destroys itself.
I dont know if someone understands and also sorry for my bad english but please help me in this.
Thanks
It sounds like you pretty much just answered your own question. Just instantiate your weapon prefab whenever it gets picked up/equipped, and then destroy it when it’s unequipped.
Yea but i want to know how to correctly instantiate the weapon (Correct position and rotation), and how to animate it within the character
You just use Instantiate() to instantiate the weapon. You can then parent the weapon to the character’s skeleton(hand bone probably) and it will follow it.
Ok, then i will work on it and also find a good technique to animate correctly the weapon once instantiated.
Thanks jRocket
You use a custom Class like Item or Weapon, which includes things like the prefab to use when equipped, the correct position and rotation, and anything else that might be necessary (addon options, zoom ability, damage, mag size). As for animation, you either use Inverse Kinematics to bind the hands to the weapons grips, and animate the weapon, or you bind the weapon to the right hand and animate the arms for reloading etc. Both methods have their advantages and disadvantages, and there may also be options for combining both.
Easiest technic I know to do this is to either have the model with pivot in the right position/rotation or to parent the model under a transform and make the relative position/rotation to this transfrom in such way that you can set its coordinates with the hand bone to zero position/rotation.
Ok, well then i will try to make a script using this info and check the results