Skip to content

0Swat/Air-Hockey-CannonJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Air hockey

Air hockey

Created by:

  • Oskar Swat
  • Marcel Tracz

University of Lodz 2023

Project Development History

Initial Game Concepts:

  • Air hockey table with paddles and puck
  • Working physics: accurate rebounds, puck slowing down, acceleration after rebounds
  • Paddle control initially sideways only, later expanded to half the table in all directions
  • Table in a dark room, overhead light - one lamp
  • Functioning scoreboard

Libraries Used:

  • Physics: Cannon.js
  • Models (room): GLTFLoader
  • Models, lights, shadows, textures: Three.js
  • Local server for display: Parcel

Initial Model Creation:

Puck:
Puck

Paddles:
Paddles
Table:
Table1 Table2
Light DEMO Version:
Light

Initial Game Physics Implementation:

Engine a :

Engine A

  • Puck rebounding off walls
  • Poor paddle control
  • Incorrect puck-paddle collision

Engine b:

Engine B

  • Puck rebounding off walls
  • Correct paddle control
  • Incorrect puck-paddle collision

Initial Implementation of cannon.js Engine:

Creating puck and paddle objects in cannon.js:
img1

Testing cannon.js engine on test objects:
img2

Adding walls in cannon.js: Adding paddle control:
img3

Initiating puck movement" Adding friction: Removing air resistance: Setting gravity correctly:
img4

Later also creating goal holes and scoring mechanics

Initial Frontend Development

Connecting ready-made models with cannon.js engine and minor adjustments :
img5

Adding ready-made room model, field, and scoreboard:
img6

Adding lights and shadows:
img7img8

Finalized Project

ready1ready2 ready3

Instructions:

Launching the game on a local server using the command:

parcel ./src/index.html.

  • Paddle control keys WSAD and IKJL.
  • Camera control using the mouse through Orbit Controls (dragging, scroll for zooming).

About

Air hockey made with Three.js and Cannon.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published