fabmax / physx-js-webidl

Javascript WASM bindings for Nvidia PhysX
MIT License
119 stars 28 forks source link

Hello world example #14

Closed LeXXik closed 2 years ago

LeXXik commented 2 years ago

I wanted to try the hello world example that you have here: https://github.com/fabmax/physx-js-webidl/blob/main/dist/helloworld.html

Here is the visual result:

https://user-images.githubusercontent.com/5677782/160239137-42e54936-61e4-4480-9743-48cc40ccf2fb.mov

The code is a copy-paste from your example, except the scene.simulate(dt) and scene.fetchResults(true) are run in a fixed update. Is there something in the example setup that causes this?

fabmax commented 2 years ago

It looks as if you only set the height of you box and not the full transform (including rotation). It should look like this:

https://user-images.githubusercontent.com/3752161/160240830-3d76c4d8-e009-4bdd-9781-613e7aa440c6.mp4

I think in the weird part in the end of your video, where the box hovers over the ground it should actually be tilted a bit.

LeXXik commented 2 years ago

Ah, but of course, I can't just use the height! What was I thinking. This looks correct now:

https://user-images.githubusercontent.com/5677782/160252250-6e2e4252-2579-450f-a5a5-8e0c71545486.mov