Phaser in 3D with Physics (yes, it works, using enable3d!)

Great stuff!

1 Like

I have some updates:

  • I released version 16 (0.0.16).
  • Added a new example.
  • Moved the repository to github.com/enable3d/enable3d.
  • Added a headless mode, which allows you to run enable3d with physics on the server (no examples yet, but it runs really fast without any additional packages like puppeteer, electron or jsdom. Just pure node.js).
  • I disable antialias by default.
  • I made a lot of improvements under the hood.

In the next release I will add more and better constraints and an example on how to use them.

Have you tried enable3d in a project? I would love to hear your feedback :smiley:

1 Like

Thanks for you~ ļ¼Œbut how can i use it in my Game for jsļ¼Œi canā€™t use ts ļ¼Œsorryļ¼ŒIā€™m new at this 怂

Examples very goodļ¼ but ļ¼ŒI donā€™t know where to start, and thereā€™s no JavaScript in the case

The examples are all written in JavaScript.

I develop in TypeScript, but publish the code in JavaScript.

Hope this helps :slight_smile:

This is not good. It creates an internal conflict of wanting to fiddle around with it vs doing what I am supposed to do! Will have a try with it at a later appropriate date!

Hi, I was wondering if itā€™s possible to run this with Phaser.CANVAS. When I tried changing just that one line it stopped working and gave me some errors.

No, it only works using WebGL.

I just published v0.18.0. The library is now really really stable :slight_smile:

It started as a simple 3D extension for Phaser and is now a very cool 3D framework.
Iā€™m really proud, and I have much fun developing it :star_struck:

Currently Iā€™m working on implementing a Web Worker for the ammo.js physics. It will run the wasm version of ammo.js inside the worker process, which will make the gaming experience a lot smoother.

I guess it will be implemented in version 19 or 20 :smiley:

Here is a test I made:
Left: ammo.js
Right: ammo.wasm.js + Web Worker

I have a lot of cool plans for the future (not really Phaser related, but cool)

  • Improving the Standalone framework.
  • Implementing a 2D renderer like PixiJS (as a plugin) for the Standalone Enable3D framework.
  • Experimenting using the Ammo Physics package for babylon.js games.
1 Like

@yannick : CONGRATULATIONS! Keep up the AWESOME work! <3 I LOVE IT! Give yourself a pat on the back! Could you add terrain RGBA splatmap & terrain slope physics?

Thanks @Thundros

What is ā€œTerrain RGBA SplatMapā€ and ā€œTerrain Slope Physicsā€? Maybe you want to open two new issues on github and explain what it is and for what it is needed?

@yannick : http://wiki.polycount.com/wiki/Splat this is an RGBA splatmap.

and terrain slope physics is where the character slowly slides down to a stop when trying to climb very steep parts of the terrain.

I see. But please open an (or two) issue anyways, so that I can keep track of it. It is easier for me to manage requested features directly on github.

ok, @yannick! thank you VERY much! <3 Will do!

@yannick : https://github.com/enable3d/enable3d/issues/22

1 Like

Iā€™ve been following this thread for a while now, wanted to chime in to say this is amazing, really really loving the updates and bringing in the wasm version along with the web worker is a game changer. Really great work :+1:

1 Like

@yannick : any luck with https://github.com/enable3d/enable3d/issues/22 ?

@yannick, Iā€™m really interested on how you used web workers to improve the performance of the scene. Would you mind to share some tips?
Btw, Itā€™s all looking awesome!!!

  • Slope Angles are included.
  • Unfortunately, I do not plan to add texture splatting. But I posted an example. You can look at its source code and write your own adaptation.

It does only work so well, because I can easily run all the physics inside the worker. For Phaser game it would not be easy, since the physics is implemented inside Phaser.

@rich Maybe in Phaser 4, where the physics will be a separate module, workers would be a nice option?

Basically I use webpack to bundle all the worker code inside a bundle. I do not use special plugins like ā€œworker-loaderā€ or ā€œworker-pluginā€. Just a simple webpack configuration.

Also I use comlink, which helps a lot!

Version 0.20.0 is now available.
If you upgrade, make sure you add { transparent: true } to the phaser config.

const config = {
  type: Phaser.WEBGL,
  transparent: true,
  scale: {
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH,
    width: 1280,
    height: 720
  },
  scene: [MainScene],
  ...Canvas()
}

@yannick thank you for thisā€¦!

1 Like