Build a Physics Launch Pad in Banter
Banter GameObjects can receive collision events when they have BanterColliderEvents. A launch pad can inspect the event's user field and call AddPlayerForce() when a player collides with the pad.
Create a visible platform with a solid collider, enable collision events, then apply an upward impulse when the event identifies a player.
- Create the pad geometry and a matching non-trigger collider.
- Add
BanterColliderEventsto the GameObject. - Handle
collision-enterand callAddPlayerForce().
Create the Pad
const launchPad = new BS.GameObject({
name: "LaunchPad",
localPosition: new BS.Vector3(0, 0.15, 3)
});
launchPad.AddComponent(
new BS.BanterBox({
width: 2,
height: 0.3,
depth: 2,
widthSegments: 1,
heightSegments: 1,
depthSegments: 1
})
);
Add the Pad Material
launchPad.AddComponent(
new BS.BanterMaterial({
shaderName: "Unlit/Diffuse",
texture: "",
color: new BS.Vector4(1, 0.75, 0.1, 1),
side: BS.MaterialSide.Front,
generateMipMaps: false
})
);
Add a Solid Collider
Use the same dimensions as the box:
launchPad.AddComponent(
new BS.BoxCollider({
isTrigger: false,
center: new BS.Vector3(0, 0, 0),
size: new BS.Vector3(2, 0.3, 2)
})
);
The collider remains solid because isTrigger is false.
Enable Collision Events
BanterColliderEvents is required for collision-enter, collision-exit, trigger-enter, and trigger-exit:
launchPad.AddComponent(
new BS.BanterColliderEvents()
);
Add the event component to the same GameObject that receives the collider event listener.
Detect the Player
The documented collision event includes the other object's name and tag, the contact point, surface normal, and a user value when the collision involves a player:
launchPad.On("collision-enter", (event) => {
console.log("Contact:", event.detail.point);
console.log("Normal:", event.detail.normal);
if (!event.detail.user) {
return;
}
scene.AddPlayerForce(
new BS.Vector3(0, 10, 0),
BS.ForceMode.Impulse
);
});
The official player-control example applies an upward impulse with the same Vector3, ForceMode.Impulse, and AddPlayerForce() pattern.
Add Haptic Feedback
The scene API can send an impulse to either hand:
scene.SendHapticImpulse(
0.5,
0.1,
BS.HandSide.LEFT
);
The arguments are amplitude, duration, and hand. Call it from the collision handler when the launch should also provide controller feedback.
Log Collision Details
During setup, log the documented fields to verify which object reaches the pad:
launchPad.On("collision-enter", (event) => {
console.log("Name:", event.detail.name);
console.log("Tag:", event.detail.tag);
console.log("Point:", event.detail.point);
console.log("Normal:", event.detail.normal);
console.log("User:", event.detail.user);
});
Remove or reduce diagnostic logging after the pad behaves as intended.
Common Questions
Why does my Banter launch pad never receive collision-enter?
Confirm that the GameObject has both a collider and BanterColliderEvents. The official reference requires the event component for collision and trigger events.
Why does the launch pad react to props as well as players?
Check event.detail.user before calling AddPlayerForce(). Return from the handler when the collision event does not include a user.
Official References
Related Navigation
- Banter Raycasts and Object Events
- Banter Controller Input and Haptics
- Banter Physics and Grabbable Objects
- Banter VR Documentation