PlayCanvas with NVIDIA PhysX


https://playcanvas.com/project/737359/overview/playcanvas-with-nvidia-physx

Project demonstrates the use of NVIDIA PhysX with Playcanvas. All physics are moved to web worker.

14 Likes

This is amazing! Do you think it would be possible to integrate the full PhysX and add it as a second option to Ammo? This could be super useful to many. :pray: @LeXXik @will

3 Likes

Very nice work, many thanks for sharing! Did you run any performance comparison with Ammo.js for large dynamic scenes?

1 Like

@pixelpros right, that may be done at some point in the future. We need to wait for better bindings coverage, at least to match the Ammo functionality.

@Leonidas thanks! The bindings are quite limited for now, so many features are simply lacking en emscripten bind. It would take some effort to expose additional bindings, so perhaps at some point later. Nevertheless, here is a stress test for comparison Ammo vs Cannon vs PhysX made by https://github.com/prestomation from Amazon team:
https://2ba77ff724a446bfad8715d24bb9cd30.us-west-2.sumerian.aws/

The example sources are based on the pending PR:

6 Likes

That’s amazing!

1 Like

Unfortunately, the demo no longer seems to function properly.

I’m on Windows 10 and using Firefox.
It’s possible that the issue is because my Firefox version is a bit outdated.
My computer has enabled PhysX.

Play Editor Errors

twttr is not defined

Rigidbody type is not supported. Aborting.

[[launch.js:15147]](https://launch.playcanvas.com/editor/scene/js/launch.js): TypeError: item is undefined

console.error/<@https://launch.playcanvas.com/editor/scene/js/launch.js:15147:17
console.error@https://launch.playcanvas.com/editor/scene/js/launch.js:15120:14
parseStores@https://launch.playcanvas.com/api/assets/files/libs/physx-system.js?id=38077639&branchId=99465918-79b9-462d-9b40-9f7120c54c25:259:33
createBodies@https://launch.playcanvas.com/api/assets/files/libs/physx-system.js?id=38077639&branchId=99465918-79b9-462d-9b40-9f7120c54c25:20:33
fire@https://code.playcanvas.com/playcanvas-stable.dbg.js:796:18
addBodiesToPhysX@https://launch.playcanvas.com/api/assets/files/example.js?id=38470888&branchId=99465918-79b9-462d-9b40-9f7120c54c25:34:18
fire@https://code.playcanvas.com/playcanvas-stable.dbg.js:796:18
onLibraryLoaded@https://launch.playcanvas.com/api/assets/files/libs/physx-system.js?id=38077639&branchId=99465918-79b9-462d-9b40-9f7120c54c25:25:18
handleWorkerResponse@https://launch.playcanvas.com/api/assets/files/libs/physx-system.js?id=38077639&branchId=99465918-79b9-462d-9b40-9f7120c54c25:51:18

Play Build Errors

Feature Policy: Skipping unsupported feature name “autoplay”. 2 [YXlzm105](https://playcanv.as/p/YXlzm105/)

The resource at “<URL>” was blocked because content blocking is enabled. 3

Powered by PlayCanvas 1.36.1 007d3f0 [playcanvas-stable.min.js:211:65](https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js)

responseType: text being served with Content-Type: text/css [playcanvas-stable.min.js:312:480](https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js)

responseType: text being served with Content-Type: text/html [playcanvas-stable.min.js:312:480](https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js)

Error while loading scene https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/1032775.json: twttr is not defined Ui.prototype.initialize@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/__game-scripts.js:524:523 _scriptMethod@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1639:35 _onInitialize@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1639:210 _callComponentMethod@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1653:337 _onInitialize@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1653:461 _helper@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1140:167 initialize@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1140:211 start@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1813:208 configure/</</</<@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/__start__.js:145:29 kc.prototype.loadScene/</<@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1804:178 _preloadScripts@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1808:192 kc.prototype.loadScene/<@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1803:308 waitForTemplatesInScene@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:983:484 load/<@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1034:163 _onSuccess@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:313:302 _onReadyStateChange@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:312:157 request/k.onreadystatechange<@https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:310:405 [__start__.js:142:37](https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/__start__.js)

Uncaught TypeError: splash is null

hideSplash https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/__loading__.js:33

fire https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:284

start https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1813

configure https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/__start__.js:145

loadScene https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1803

load https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:1034

_onSuccess https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:313

_onReadyStateChange https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:312

onreadystatechange https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js:310

[__loading__.js:33:9](https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/__loading__.js)

responseType: text being served with Content-Type: application/javascript [playcanvas-stable.min.js:312:480](https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/r626aLbg/playcanvas-stable.min.js)

+1

The project itself doesn’t work for me, but the live demo from the twitter link does work (https://twitter.com/xik_le/status/1330332234230927361).

What is the issue? I really like this to work.

The issue is that the project was using private engine API that has been changed since then. The project will need to be updated.

I’ve made a fix to this in a fork: https://playcanvas.com/project/837719/overview/playcanvas-with-nvidia-physx

1 Like

I get error:

twttr is not defined

It is used for the Twitter button in the UI. You can remove the UI script completely, or add https://platform.twitter.com/widgets.js to external scripts in project settings.

You have an ad or content blocker enabled in/on the browser.

1 Like

hi yaustar,

i try your last physX project, but i’ve got this error message :cold_sweat:
thank u for your help

probleeem

I believe kinematics weren’t supported in the original project that LeXXik did.

The demo has a very limited feature set and was more of a tech demo by LeXXik. If you need more features, you will have to look at developing it further yourself unfortunately.

1 Like

thank u :raised_hands: