Attach Banter Objects to Player Hands, Head, Feet, Chest, and Back
The Banter UserData API can attach a GameObject to a supported player body location. Use it for runtime badges, held displays, wearable props, indicators, or other content that should follow a specific user attachment point.
Resolve the intended user, create the GameObject, set its local transform for the attachment point, then call UserData.Attach with an AttachmentType value.
- Use
scene.localUseror a connected user from the scene. - Create the object and add its visible or interactive components.
- Attach it with the official
BS.AttachmentTypeenum.
Attach an Object to the Local User
const badge = new BS.GameObject({
name: "PlayerBadge",
localPosition: new BS.Vector3(0, 0, 0)
});
scene.localUser.Attach(
badge,
BS.AttachmentType.Chest
);
The GameObject follows the selected body attachment after it is attached.
Supported Attachment Types
The official API currently lists:
BS.AttachmentType.HeadBS.AttachmentType.LeftHandBS.AttachmentType.RightHandBS.AttachmentType.LeftFootBS.AttachmentType.RightFootBS.AttachmentType.ChestBS.AttachmentType.Back
Use the enum value rather than a body-location string.
Attach to Another Connected User
The scene exposes connected users through its users collection. Once the required UserData object has been resolved:
user.Attach(
markerObject,
BS.AttachmentType.Head
);
Use stable user information from UserData when deciding which connected user should receive the object.
Position and Rotate the Attached Object
Configure the object's local transform for the attachment location:
badge.SetLocalPosition(
new BS.Vector3(0, 0.05, 0.02)
);
badge.SetLocalEulerAngles(
new BS.Vector3(0, 0, 0)
);
badge.SetLocalScale(
new BS.Vector3(0.2, 0.2, 0.2)
);
Test offsets separately for each attachment type. A hand offset will not necessarily suit the head, chest, or back.
Add Visual Components before Attaching
badge.AddComponent(new BS.BanterBox({
width: 1,
height: 0.4,
depth: 0.05
}));
badge.AddComponent(new BS.BanterMaterial({
color: new BS.Vector4(1, 0.8, 0.1, 1)
}));
Keep the returned GameObject reference if the script must later change its transform, visibility, text, material, or lifecycle.
Track User Join and Leave Events
When attachments are created for remote users, connect the workflow to:
user-joineduser-left
Create the attachment after the user is available, and clean up runtime objects when that user leaves.
Common Questions
Why is my Banter attachment inside the player's body?
Adjust the GameObject's local position, rotation, and scale for the selected attachment type.
Why does my attachment use the wrong hand?
Check whether the enum is LeftHand or RightHand. Use the official BS.AttachmentType value rather than a custom string.
Official References
Related Navigation
- Banter Multiplayer State and Events
- Banter GameObjects and Hierarchies
- Banter Rendering and Geometry
- Banter VR Documentation