Player characters can be found inside the Game/Prefabs/PlayerPrefabs folder:



There's a player prefab for each of the selectable characters from the main menu.


Selecting one of the prefab shows several components in the inspector. The main game attributes can be configured in the Network Player component:



For example, you can change the Build Max Distance, melee range & damage points (when using bare hands, otherwise the damage is defined in the item definition of the weapon), the initial inventory, the score given to other players for being killed, etc.


Changing player models

Changing the model is fairly straightforward, it is recommended that you duplicate an existing character prefab and modify it though. The model is a seperate entity under the 'Crouch' object. You can replace it with a character that has a 'Humanoid' rig.

Align your new model with the model that already exists in the prefab and assign the correct 'Avatar' definition file to the 'Animator' component that resides on the base object of the prefab.

There are three (3) objects the 'NetworkPlayer' component looks for by name which you can assign yourslef by making the fields public or serialized, rename in the model or rename in the script:

1. 'Biped Spine1', which is mapped to the 'Humanoid.Chest' bone of the 'Avatar'.
2. 'Biped R Hand', which is mapped to the 'Humanoid.RightHand' bone of the 'Avatar'.
3. 'Bow', which is the mesh object of the Bow, which usually has a 'SkinnedMeshRenderer' on it.

How are these used and when:

1. The first one is used to orient first person animations and synchronize look direction to other clients, just assigning this 'Transform' should be enough

2. The second one is used to attach weapons to and needs to be correctly oriented, if you can't achieve correct orientation, create a child object with the correct orientation - by comparing to the existing model - and rename or change the name in code to get the reference to that 'Transform' during runtime.

3. The third one is for the 'Bow' to function, in this confiiguration the bow's string is animated and the bones follow the left hand, which makes it a tricky setup, but the script actually only requires an object named 'Bow' to function, so you can make an empty one. The 'ArrowNetworked' prefab is spawned from the 'RightHand' (or the child object you created) like the weapons and also gets it's direction in the same way, so you can still have the function of a Bow and Arrow.

To correctly setup a 'Bow' object the use of a 3D application like Blender or 3dsmax would be suggested, which could be made easier by modifying one of the existing characters and their setup.

You can also set the head, hat and/or hair fields to hide these objects for first person mode if they are separate in your model.

Now you should add a 'Collider' component to the parts of the character you want to be able to inflict damage on, each part should also have a 'DamageTaker' component, which has a parameter called 'Damage Multiplier' which as the name suggests can be used to multiply damage, which is how we implement headshots in the game (DamageMultiplier = 2), but could also be used for armor for example if the value is between 0-1.

Finally remove the old model (or disable it) and test the game by assigning the correct prefab on the 'NetworkManager's' 'Registered Spawnable Prefabs' list - this prefab can be found unther 'Game/Prefabs'.

NOTE: If you aren't using VoxelPlay materials on your character check the component 'VoxelPlay Behaviour' on the base object, it has an option to replace all materials with VoxelPlay ones.