Banter Controller Input, Player Controls, and Haptics

BanterScene can block individual controller inputs and expose their button or axis values to JavaScript. It can also enable and disable player abilities, teleport the player, apply forces, change speed mode, and send haptic feedback to either hand.

Custom Input Flow

Register the controller event listeners first, block only the inputs the system replaces, and restore the normal input state when the interaction ends.

  1. Wait for unity-loaded and register button or axis listeners.
  2. Block the specific left- or right-hand input the custom system consumes.
  3. Use BS.ButtonType and BS.HandSide to interpret events.

Block Controller Buttons

The current API provides separate blocking methods for primary and secondary buttons on each hand:

scene.SetBlockLeftPrimary(true);
scene.SetBlockLeftSecondary(true);
scene.SetBlockRightPrimary(true);
scene.SetBlockRightSecondary(true);

Block only the button the custom interaction handles. Set the same method back to false when normal control should resume.

Listen for Button Presses and Releases

scene.On("button-pressed", (event) => {
  console.log(event.detail.button);
  console.log(event.detail.side);
});

scene.On("button-released", (event) => {
  console.log(event.detail.button);
  console.log(event.detail.side);
});

The button value uses BS.ButtonType. The side uses BS.HandSide.

The documented button types include trigger, grip, primary, secondary, and thumbstick.

Block and Read Thumbsticks

scene.SetBlockLeftThumbstick(true);
scene.SetBlockRightThumbstick(true);
scene.SetBlockLeftThumbstickClick(true);
scene.SetBlockRightThumbstickClick(true);

Read the continuous axis event:

scene.On("controller-axis-update", (event) => {
  console.log(event.detail.hand);
  console.log(event.detail.x, event.detail.y);
});

The documented X and Y values run from -1 to 1.

Block and Read Triggers

scene.SetBlockLeftTrigger(true);
scene.SetBlockRightTrigger(true);

scene.On("trigger-axis-update", (event) => {
  console.log(event.detail.hand);
  console.log(event.detail.value);
});

The trigger value runs from 0 to 1.

Control Player Abilities

The official scene methods separately control:

  • movement
  • rotation
  • crouching
  • teleporting
  • grappling
  • jumping
  • grabbing
scene.SetCanMove(false);
scene.SetCanRotate(true);
scene.SetCanTeleport(false);
scene.SetCanGrab(true);

Restore each changed ability when a menu, seat, round, or interaction releases the player.

Teleport and Apply Force

scene.TeleportTo(
  new BS.Vector3(0, 5, 0),
  90,
  true,
  false
);

scene.AddPlayerForce(
  new BS.Vector3(0, 10, 0),
  BS.ForceMode.Impulse
);

The teleport arguments in the official example are position, Y rotation, whether to stop velocity, and whether the destination is treated as a spawn.

Speed Mode and Haptics

scene.PlayerSpeed(true);

scene.SendHapticImpulse(
  0.5,
  0.1,
  BS.HandSide.LEFT
);

The haptic arguments are amplitude, duration, and hand.

Common Questions

Why did the normal Banter controller action stop working?

Check every SetBlock... method used by the script and set the blocked input back to false when the custom interaction ends.

Why do I receive continuous thumbstick events?

The official API states that controller-axis-update fires continuously while the thumbstick moves. Process the current X and Y values rather than treating it as a single button press.

Official References

Related Navigation