Skip to content

yanis7774/Physics-library-for-Decentraland

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Physics-library-for-Decentraland

How to add Cannon-ES library to SDK.

Awesome Repository. - There are a few examples of using a physics engine in Decentraland. Billiard Game, Shooting game 1, Shooting game 2, Shooting game 3, Car Scene, Frisbee Throwing, BasketBall.

All these examples use cannon.js library to implement physics on the scene, which is outdated and hasn’t maintance since 2016. There are a lot of bugs and shortcomings.

Cannon-ES is the fork of “cannon.js”, with improvements and recently updated.

So what do we need to add it to SDK? A few steps:

  1. Install cannon-es

Add to “package.json”, cannon-es as dependency to your project and run npm install

This is an image

  1. Add the source file to “include” section of tsconfig.json

This is an image

  1. Import it with absolute path.

CORRECT:

import {World} from "./node_modules/cannon-es/dist/cannon-es";

INCORRECT:

import {World} from "cannon-es";

About

How to add “cannon-es” library to SDK.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published