- Home /
Adding objects on player models in a multiplayer game
I'm trying to figure out the best way to go about this: I want each of my multiplayer game avatars to be able to have weapon/item models on their person when they have each of these specific items/weapons. E.g. if they have a crossbow holstered, a crossbow model would show on their back.
I'm trying to figure out if it's better to either:
A. Attach each item/weapon model to all possible positions (holstered on back and equipped in hands) then just send an RPC with which one to enable and which one to disable when required; or
B. Instantiate across the network the object at either the holstered position or the equipped position then destroy it and re-instantiate it at a different position when required.
Am I right in thinking the best solution is going to be A? Is there a better way to handle this?
I should define in each model a method for every part like "Equip in hand", "Equip in head" that receive the object and adjust the coordinates and the parent of equipping in these parts (only one position/rotation per method).
This way, if you have 10 body positions, 1000 models and 1000 objects, you only need to define 22000 coordinates (position and rotation)
There ways to make it only using one method (but with same number of coordinates) if you know how to use Enums.
So you mean define the points on the model where each item/weapon would sit, then create the object and just move it's location?
Yes! In the object just make default position and rotation values using Instantiate()
with one parameter.
Your answer
Follow this Question
Related Questions
Network Manager NetworkServer.Spawn isn't working 0 Answers
Multiplayer FPS Character Model Question 3 Answers
Network.Instatiate Problem 0 Answers
Player Weapon Scripting 1 Answer