3D Avatar
The CustomizeAvatar
component makes it possible to embed customizable 3D avatars on any fan application. This component allows users to view and customize their in-game avatars with different wearables and items from their inventory.
Installation
To use the CustomizeAvatar
component, install the @xborglabs/avatar
package:
Or using yarn:
Basic Usage
Import and use the component in your React project:
Props
Required Props
slots
InventorySlotType[]
Current inventory slots used to build the avatar. These define which items are equipped on the avatar.
config
object
Configuration for the avatar, retrievable per tenant using getPublicConfig()
from @xborglabs/ui-shared
.
Optional Props
className
string
Custom HTML class for additional styling.
cameraZoom
string
Specifies which part of the avatar to zoom in on. Possible values: all
, left-hand
, right-hand
, headgear
, upper-body
, lower-body
, boots
.
Advanced Usage
Zooming to Specific Body Parts
You can direct the camera to focus on specific parts of the avatar:
Configuration Example
The config
object contains settings for camera positioning, zoom constraints, and interactivity. Below is an example configuration:
Configuration Properties
distance
number
Default camera distance from the avatar
maxDistance
number
Maximum allowed camera distance for zoom out
minDistance
number
Minimum allowed camera distance for zoom in
zoomAllowed
boolean
Whether users can zoom in/out with mouse wheel
controlsAllowed
boolean
Whether users can rotate the avatar with mouse drag
zoomConfig
object
Configuration for camera positioning for different focus areas
Performance Considerations
The 3D avatar may require significant resources to render, especially on lower-end devices
Consider implementing loading states for slower connections
Browser Compatibility
The CustomizeAvatar
component uses WebGL for rendering and is compatible with all modern browsers that support WebGL:
Chrome 9+
Firefox 4+
Safari 5.1+
Edge 12+
Opera 12+
Mobile support depends on the device's GPU capabilities and available memory.
Support
For additional support or questions about the CustomizeAvatar
component, please contact XBorg's developer support team.
Last updated