Skip to content

Pinball

Description

This physics example demonstrates different ways of animating static Cannon bodies. I.e., they have mass=0.

  • The Flippers and Spring launcher are compound shapes and react to keyboard presses.
  • The Bumpers implement the onCollide event to quickly scale the mesh to give it the impression that it is quickly expanding and contracting when something bumps into it.
  • The Ball implements the onCollide event to multiply its current velocity by 10 in case it hits a Bumper.
  • The Sliding Box is animated left and right, over time by subscribing to the Cannon Body API position property.

Working Example

<>
Pinball (Working Example) sbedit.net

GitHub Branch

git clone https://github.com/Sean-Bradley/React-Three-Fiber-Boilerplate.git
cd React-Three-Fiber-Boilerplate
git checkout pinball
npm install
npm start

Comments