Skip to content
/ fps0 Public

A ThreeJS/physics experiment, with first person controls and minimal collision detection

Notifications You must be signed in to change notification settings

dirkk0/fps0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FPS0

A ThreeJS/physics experiment, with first person controls and minimal collision detection.

The goal of this project was to explore the options for a simple game with first person controls that runs completely in a browser. To achieve this I wanted to be able to

  • load a 'level', i.e. a basic 3D model (in this case with Blender)
  • create 'WASD' first person type of controls
  • apply simple physics with collision detection to walk around and interact with objects
  • add dynamic objects on runtime

Luckily, all of the ground work was already done by someone else. :-)

Basically this demo merges the Blender scene loader of mrdoobs ThreeJS library and the CannonJS FPS example by schteppe.

I added the idea that the imported Blender geometry gets turned into a static model in the physics engine by finding the cubes and adding invisible physical collision boxes to their position.

This worked surprisingly well and gives some sort of minimal FP(S) - completely running in the browser. The imported Blender model is turned into a static model by adding the boxes as static physic objects. This way this you can 'walk' on the objects of the Blender model (the grey objects in the screenshot).

Screenshot

Important: to try it locally you still must run it from a web server (for example 'python -m SimpleHTTPServer') due to cross-origin security issues.

About

A ThreeJS/physics experiment, with first person controls and minimal collision detection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published