Player Entity Cosmetics

By default, the DefaultPlayerEntity class has all cosmetics enabled for players. Oftentimes though, you may want to have control over player cosmetics, and if certain or all cosmetics are shown, or hidden.

The HYTOPIA SDK gives you control over player cosmetic behaviors for your game in a variety of ways.

Test players with randomly assigned cosmetics

Development Environment Behavior

In your local development environment, by default all test players will spawn with randomly assigned cosmetics when using the DefaultPlayerEntity class with it's default player model.

This is to simulate expectations around cosmetic usage in game. If you'd like to disable this, you can follow the guides below.

Disabling Player Cosmetics

The DefaultPlayerEntity class accepts a cosmeticHiddenSlots option, which is an array of cosmetic slot types you can provide to disable visibility of cosmetics in those slots within your game.

You can view the complete documentation of the DefaultPlayerEntity class here.

The cosmeticHiddenSlots option accepts an array that can contain one or more of the following cosmetic slot values. For example, if you want to hide all cosmetics for players, you can use [ 'ALL' ] for the value of cosmeticHiddenSlots. Or maybe you just want to hide held item cosmetics. If so you could use [ 'LEFT_ITEM', 'RIGHT_ITEM' ] for the value of cosmeticHiddenSlots.

'ALL' | 'BACK' | 'HEAD' | 'LEFT_ARM' | 'LEFT_FOOT' | 
'LEFT_HAND' | 'LEFT_ITEM' | 'LEFT_LEG' | 'RIGHT_ARM' | 
'RIGHT_FOOT' | 'RIGHT_HAND' | 'RIGHT_ITEM' | 'RIGHT_LEG' | 
'TORSO';

Using Different Player Models

Cosmetics are compatible with custom player models in your game when using the DefaultPlayerEntity class. If you've provided an alternative modelUri option when creating an instance of the DefaultPlayerEntity for a given player, a player's equipped cosmetics will by default attempt to be applied to your custom model.

For cosmetics to be applied to your custom model, you must use the DefaultPlayerEntity class, and most importantly your model must have the correct named anchor nodes for the cosmetic types you wish to support. If you model does not have the correct anchor node, cosmetics for that required type & node will not be applied.

For example, here is the mapping of cosmetic slot type to required anchor node that is expected by the system when attempting to render cosmetics on your custom model.

Keep in mind cosmetics are 100% visual only, they do not by default effect game mechanics or game physics.

Slot Name
Required Model Node Name
Type Of Cosmetics

BACK

back-anchor

Backpacks, capes, etc

HEAD

head-anchor

Helmets, hats, etc

LEFT_ARM

arm-left-anchor

Arm sleeves, gauntlets, etc

LEFT_FOOT

foot-left-anchor

Shoes, boots, etc

LEFT_HAND

hand-left-anchor

Gloves, rings, etc

LEFT_ITEM

hand-left-anchor

Swords, shields, held items

LEFT_LEG

leg-left-anchor

Pants, leggings, etc

RIGHT_ARM

arm-right-anchor

Arm sleeves, gauntlets, etc

RIGHT_FOOT

foot-right-anchor

Shoes, boots, etc

RIGHT_HAND

hand-right-anchor

Gloves, rings, etc

RIGHT_ITEM

hand-right-anchor

Swords, shields, held items

RIGHT_LEG

leg-right-anchor

Pants, leggings, etc

TORSO

torso-anchor

Jackets, armor, etc

Last updated