kripken / ammo.js

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

Differences between closure and no closure for pointer #43

Open stoomm opened 11 years ago

stoomm commented 11 years ago

Hello,

A little difference between versions with closure and without closure.

In the closure version (ex : ammo.small.js), we can get the pointer with object.a In the no closure version (ex : ammo.fast.js or ammo.asm.js), it's object.ptr

FYI, object.a is used in physijs (a plugin for three.js : http://chandlerprall.github.com/Physijs/)

For testing, you can see this with a body :

[...] var body = new Ammo.btRigidBody(rbInfo); console.log(body.ptr); console.log(body.a); [...]

Another little problem : even if asm.js is not implemented yet in Chrome, Chrome for Android crash with ammo.asm.js (too large file ?).

Thanks :)

Stoomm.

kripken commented 11 years ago

Closure minifies ptr to a, yes. Generally using .ptr is not recommended, btw.

Note that in the asm build, closure is not used so it will be .ptr.

If it crashes in chrome for android, I would file a bug for them so they can fix it.