A virtual reality 8-ball pool game developed with Godot Engine and Godot XR Tools, built on top of Godot XR Template.
Play a full game of 8-ball against a bot opponent, using your VR controllers to physically grip and shoot the cue.
- One hand — grab the cue to move it freely. Hits with one hand do not count as a turn.
- Two hands — aim with precision. The cue direction is calculated from the line between both hands.
- Front hand trigger — locks the cue direction. Slide the rear hand back and forward to strike.
Standard 8-ball rules apply:
- 16 balls total: 1 cue ball, 7 solids (1–7), 7 stripes (9–15), and the 8 ball.
- Ball type (solids or stripes) is assigned to each player on the first pocketed ball.
- Pocket all your balls, then pocket the 8 ball to win.
- Pocketing the 8 ball before clearing your balls loses the game.
- Pocketing the cue ball is a foul — the cue ball respawns and the turn passes to the opponent.
The bot evaluates every combination of its balls and pockets each turn. For each candidate shot it:
- Calculates the ideal contact point on the target ball.
- Checks the cue ball → contact point path is clear.
- Checks the target ball → pocket path is clear.
- Scores the shot by angle quality and distances.
If no valid shot is found, the bot hits in a random direction.
| Script | Description |
|---|---|
palo.gd |
Cue logic: two-hand grab, orientation, trigger lock, tip collision |
bola.gd |
Ball properties: number, cue ball flag, out-of-bounds flag |
pocket.gd |
Pocket detection: emits ball_pocketed signal |
out_of_bounds.gd |
Detects balls falling off the table and respawns/removes them |
scoreboard.gd |
Real-time scoreboard rendered on a 3D panel via SubViewport |
game_manager.gd |
Autoload singleton: turn logic, scoring, fouls, win condition, bot |
| Asset | Source |
|---|---|
| Pool cue | Fab by Epic Games by plaggy |
| Pool table | Free3D by peterdavidmchugh |
| Pool balls | Free3D by printable_models |
Wall textures generated procedurally with Godot's NoiseTexture2D.
Mikel Ezquerro · Ander Berruezo — Realidad Virtual y Aumentada