kripken / ammo.js

Direct port of the Bullet physics engine to JavaScript using Emscripten
Other
4.14k stars 557 forks source link

class methods in CPP but not in JS #210

Open elbriga opened 5 years ago

elbriga commented 5 years ago

Hi all, I want to change the rope's segment length (rest length?), but other question appeared...

Browsing the CPP source I come across many methods, like resetLinkrestLength, setRestLengthScale, updateConstants, ... in btSoftBody.cpp, that are not in the JS object (inspecting on the console).

Is there a way to access such methods in JS?

kripken commented 5 years ago

The methods exposed to JS need to be added to ammo.idl. Can look at the history of that file to see PRs adding new things - PRs are always welcome.

(You can also remove methods from ammo.idl and rebuild, to generate a build with only what you want.)

elbriga commented 5 years ago

Just figured it out now. Sorry for the anxiety. lol Added the method for setting the RestLinkScale on the btSoftBody. Works like a charm!

elbriga commented 5 years ago

Had little trouble with webidl, the apt version of emscripten on my Linux Mint complained about it. Installing it from source did the trick