An interactive simulation on pendulum motion under different gravitational fields — the first SHIFT simulation built on the adapted MVC architecture that became the standard for the rest of the series.
- About the Game
- Key Features
- How to Play
- Tech Stack
- Installation and Setup
- Architecture and Technical Highlights
- License
- Author
Pendulum Goal is the fifth simulation of the SHIFT series, developed between August and November 2024. It allows players to explore the physical behavior of pendulums on different planets. The objective is to dodge swinging pendulums while attempting to score goals — with pendulum motion governed by the gravity of each stage (Earth, Moon, and Jupiter).
This simulation was inspired by football and is controlled by a single on-screen button to kick the ball. A new feature introduced in this simulation is the display of physics-related statements at the end of each gameplay cycle, reinforcing the observed phenomenon and connecting the gameplay to the formal relationship between pendulum length, gravity, and oscillation period.
- Three Gravitational Stages:
- 🌍 Earth: g = 9.8 m/s²
- 🌙 Moon: g = 1.6 m/s²
- 🪐 Jupiter: g = 24.8 m/s²
- Pendulum Physics via Havok: Each stage features sequences of long and short pendulums, allowing observation of how length and gravity influence the oscillation period.
- Educational Insight Cards: Brief physics statements are presented at the end of each stage.
- Single-Button Hypercasual Gameplay: The entire game is controlled by a single button, aiming for an accessible and intuitive interaction.
- Multilingual: Native support for Portuguese and English.
Objective: Avoid the swinging pendulums while attempting to score goals.
💻 On PC: Spacebar or any key to kick the ball.
📱 On Mobile / Touch: Tap the on-screen button to kick the ball.
You can switch between Portuguese and English using the button in the top-right corner.
| Tool | Version | Description |
|---|---|---|
| TypeScript | 5.7.2 | Core language, providing type safety and modular architecture. |
| Babylon.js | 7.5.0 | Graphics engine for 3D rendering, animations, and GUI system. |
| Havok | latest | Physics engine for realistic rigid-body interactions. |
| Vite.js | 5.2.11 | Build tool for ES6 module compilation, tree-shaking, and optimization. |
| Node.js | 20+ | Development environment and runtime. |
Prerequisites: Node.js (v20+), npm (v10+).
npm install
npm run dev # development server
npm run build # production build (generates the dist folder)Pendulum Goal introduced the adapted MVC (Model-View-Controller) architecture that would become the standard for the remaining simulations of the SHIFT series. After the limited applicability of Domain-Driven Design in the previous simulation, this lighter and more explicit pattern proved better suited to a real-time physics simulation context. The same MVC organization is used in PhET Interactive Simulations.
src/
├── Controller/ — Game logic, gravity selection, camera control
├── Model/ — Domain entities (pendulums, ball, gravity types, road)
├── View/ — GUI, language switching, in-game physics statements
└── Core/ — Infrastructure: scene, engine, camera, debug, physics
- Controller layer: Coordinates user input, scene state, and gravity transitions between Earth, Moon, and Jupiter stages.
- Model layer: Domain entities including
Pendulum,PendulumsManager,SpherePlayer,SpherePlayerManager, andRoad/RoadsManager. - View layer: GUI rendering via Babylon GUI, with
LanguageDetector,ViewLanguageSwitcher, and dedicated views for in-game physics statements (ViewBallOutPhrase,ViewPendulumPhrase). - Core layer: Scene initialization, camera and engine setup, performance monitoring, and the Havok physics engine adapter (
HavokPhysicsEngine,HavokDebugger,PhysicsDebugger).
The simulation uses the Havok physics engine for pendulum dynamics. Each stage simply changes the gravitational acceleration parameter, and the resulting period changes emerge naturally from the physics integration — no manual period equations are hardcoded in the simulation logic. The educational insight cards displayed between rounds are loaded from a localized JSON, allowing easy extension or translation of the physics statements.
The MVC pattern adopted here was further refined in subsequent simulations of the series, including the addition of a custom callback-based mediator pattern in Faraday Game and Carnot Game.
The source code in this repository is licensed under the MIT License — see the LICENSE file.
3D models, textures, and original visual content created by the author are licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Music and sound effects in this project are sourced from Pixabay under the Pixabay Content License, which permits free use including for commercial purposes.
- Babylon.js — Apache License 2.0
- Havok Physics — Per vendor terms (Babylon.js distribution)
- Vite.js — MIT License
Copyright © 2024 Rafael João Ribeiro.
Developed by: Prof. Dr. Rafael João Ribeiro Federal Institute of Paraná (IFPR) www.fisicagames.com.br

