Skip to content

Navigation Menu

Sign in
Sign up

Is it possible to import Cannon ES just like Cannon JS #149

Unanswered
AryaaSk asked this question in Q&A
Discussion options

I have been using CannonJS, but recently I have realised that there are some issues and the library has been unmaintained for many years, so I found cannon-es.

It looks good but I need to be able to import it using a script tag, not an NPM install.

In CannonJS you can just import it like this:

<script src="https://cdnjs.cloudflare.com/ajax/libs/cannon.js/0.6.2/cannon.js"></script> 
<script>
//And then just use like this
const world = new CANNON.World();
</script>

Is there a way to import Cannon-Es the same way ?

You must be logged in to vote

Replies: 1 comment

Comment options

yes of course! you can import it like this:

<script type="module">
import * as CANNON from 'https://unpkg.com/cannon-es@0.19.0/dist/cannon-es.js'
// And then just use like this
const world = new CANNON.World();
</script>
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #148 on May 02, 2022 15:01.

AltStyle によって変換されたページ (->オリジナル) /