Giter VIP home page Giter VIP logo

kripken / ammo.js Goto Github PK

View Code? Open in Web Editor NEW
4.0K 116.0 545.0 43.67 MB

Direct port of the Bullet physics engine to JavaScript using Emscripten

License: Other

CMake 1.16% C++ 75.86% Lua 0.07% C 20.30% JavaScript 0.33% Shell 0.06% Python 0.05% HTML 0.01% GLSL 0.01% Objective-C 0.25% Objective-C++ 0.05% Makefile 0.26% Cuda 0.56% TeX 0.07% Batchfile 0.01% HLSL 0.07% M4 0.89% Rich Text Format 0.01% Dockerfile 0.01%

ammo.js's Introduction

ammo.js

Demos

Overview

Example code to give you an idea of the API:

ammo.js is a direct port of the Bullet physics engine to JavaScript, using Emscripten. The source code is translated directly to JavaScript, without human rewriting, so functionality should be identical to the original Bullet.

'ammo' stands for "Avoided Making My Own js physics engine by compiling bullet from C++" ;)

ammo.js is zlib licensed, just like Bullet.

Discussion takes place on IRC at #emscripten on Mozilla's server (irc.mozilla.org)

Instructions

builds/ammo.js contains a prebuilt version of ammo.js. This is probably what you want.

You can also build ammo.js yourself.

Usage

The most straightforward thing is if you want to write your code in C++, and run that on the web. If so, then you can build your C++ code with emscripten normally and either build and link Bullet using

https://emscripten.org/docs/compiling/Building-Projects.html

or you can use Bullet directly from emscripten-ports, with -s USE_BULLET=1. In both cases, you don't need ammo.js, just plain Bullet.

If, on the other hand, you want to write code in JavaScript, you can use the autogenerated binding code in ammo.js. A complete example appears in

examples/hello_world.js

That is HelloWorld.cpp from Bullet, translated to JavaScript. Other examples in that directory might be useful as well. In particular see the WebGL demo code in

examples/webgl_demo/ammo.html

Bindings API

ammo.js autogenerates its API from the Bullet source code, so it should be basically identical. There are however some differences and things to be aware of:

  • See https://github.com/kripken/emscripten/wiki/WebIDL-Binder for a description of the bindings tool we use here, which includes instructions for how to use the wrapped objects.

  • All ammo.js elements should be accessed through Ammo.*. For example, Ammo.btVector3, etc., as you can see in the example code.

  • Member variables of structs and classes can be accessed through setter and getter functions, that are prefixed with |get_| or |set_|. For example,

    rayCallback.get_m_rayToWorld()

    will get m_rayToWorld from say a ClosestRayResultCallback. Native JavaScript getters and setters could give a slightly nicer API here, however their performance is potentially problematic.

  • Functions returning or getting float& or btScalar& are converted to float. The reason is that float& is basically float* with nicer syntax in C++, but from JavaScript you would need to write to the heap every time you call such a function, making usage very ugly. With this change, you can do |new btVector3(5, 6, 7)| and it will work as expected. If you find a case where you need the float& method, please file an issue.

  • Not all classes are exposed, as only what is described in ammo.idl is wrapped. Please submit pull requests with extra stuff that you need and add.

  • There is experimental support for binding operator functions. The following might work:

    Operator Name in JS
    = op_set
    + op_add
    - op_sub
    * op_mul
    / op_div
    [] op_get
    == op_eq

Building

In order to build ammo.js yourself, you will need Emscripten and cmake.

For more information about setting up Emscripten, see the getting started guide.

To configure and build ammo into the builds directory, run the following:

$ cmake -B builds
$ cmake --build builds

There are also some key options that can be specified during cmake configuration, for example:

$ cmake -B builds -DCLOSURE=1                # compile with closure
$ cmake -B builds -DTOTAL_MEMORY=268435456   # allocate a 256MB heap
$ cmake -B builds -DALLOW_MEMORY_GROWTH=1    # enable a resizable heap

On windows, you can build using cmake's mingw generator:

> cmake -B builds -G 'MinGW Makefiles'
> cmake --build builds

Note that if you have not installed emscripten via the emsdk, you can configure its location with -DEMSCRIPTEN_ROOT.

Building using Docker

ammo.js can also be built with Docker. This offers many advantages (keeping its native environment clean, portability, etc.). To do this, you just have to install Docker and run:

$ docker-compose build        # to create the Docker image
$ docker-compose up           # to create the Docker container and build ammo.js
$ docker-compose run builder  # to build again the ammojs targets after any modification

If you want to add arguments to cmake, you have to edit the docker-compose.yml file.

Reducing Build Size

The size of the ammo.js builds can be reduced in several ways:

  • Removing uneeded interfaces from ammo.idl. Some good examples of this are btIDebugDraw and DebugDrawer, which are both only needed if visual debug rendering is desired.

  • Removing methods from the -s EXPORTED_RUNTIME_METHODS=[] argument in make.py. For example, UTF8ToString is only needed if printable error messages are desired from DebugDrawer.

Testing

You can run the automatic tests with npm test, which in turn will run ava against both the javascript and WebAssembly builds:

$ npm run test-js      # --> AMMO_PATH=builds/ammo.js ava
$ npm run test-wasm    # --> AMMO_PATH=builds/ammo.wasm.js ava

It's also possible to run ava directly for more options:

$ npx ava --verbose
$ npx ava --node-arguments inspect

When no AMMO_PATH is defined, builds/ammo.js is tested by default.

Running the Examples

http-server is included as a dev dependency as an easy way to run the examples. Make sure to serve everything from the repo root so that the examples can find ammo in the builds directory:

$ npx http-server -p 3000 .

Troubleshooting

  • It's easy to forget to write |new| when creating an object, for example

    var vec = Ammo.btVector3(1,2,3); // This is wrong! Need 'new'!

    This can lead to error messages like the following:

    Cannot read property 'a' of undefined Cannot read property 'ptr' of undefined

    This is an annoying aspect of JavaScript, sadly.

Reporting Issues

If you find a bug in ammo.js and file an issue, please include a script that reproduces the problem. That way it is easier to debug, and we can then include that script in our automatic tests.

Release Process

Pushing a new build in builds/ammo.js should be done only after the following steps:

  • Configure with closure enabled: cmake -B builds -DCLOSURE=1

  • Build both the asm.js and wasm libraries: cmake --build builds

  • Make sure they pass all automatic tests: npm test

  • Run the WebGL demo in examples/webgl_demo and make sure it looks ok, using something like firefox examples/webgl_demo/ammo.html (chrome will need a webserver as it doesn't like file:// urls)

Upstream Version

Bullet 2.82 patched with raycast fix from 2.83

ammo.js's People

Contributors

beiller avatar bunzaga avatar crazyquark avatar dependabot[bot] avatar donalffons avatar dvlp avatar fabienrohrer avatar guzzard avatar iamnotstone avatar ianpurvis avatar infinitelee avatar jaycelai avatar jazzzz avatar juj avatar kripken avatar lexxik avatar luisfonsivevo avatar mackeyk24 avatar mrdoob avatar nickpepper avatar oliverxh avatar richtrr avatar sbc100 avatar shannon avatar silverweed avatar swift502 avatar vincentfretin avatar willeastcott avatar yaustar avatar yomboprime avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ammo.js's Issues

Unclear type in struct: <2 x float>, in %64

To "deal" with multi-arch issues on Debian, I had to apply the multi-arch patch mentioned in a Debian llvm-2.9 bug report and build llvm from debians Sid(unstable) repository.

Debians clang in Sid depends on gcc/g++-4.6, which I have a problem with, so I got the ubuntu sources (which use gcc/g++-4.5) and built/installed them.

Running the emscripten test is a lot faster!

python tests/runner.py clang_0_0.test_the_bullet
Running Emscripten tests...
test_the_bullet (main.clang_0_0) ... ok


Ran 1 test in 265.325s

OK

This compares with 664.900s when it was based on 4.3.

Unfortunately building ammo.js raises a problem:

// Unclear type in struct: <2 x float>, in %64
Assertion failed: undefined
Stack: Error
at assertTrue (utility.js:60:23)
at eval at (/v3c/dev/kripken/emscripten/src/compiler.js:65:6)
at Array.map (native)
at Object.calculateStructAlignment (eval at (/v3c/dev/kripken/emscripten/src/compiler.js:65:6))
at analyzer.js:201:19
at Array.forEach (native)
at Object.analyzeTypes as processItem
at Object.process (framework.js:155:26)
at framework.js:104:25
at Array.forEach (native)
utility.js:61: Assertion failed: undefined
throw msg;
^

trying to get a collition callback

I am trying to find a way to know which objects are currently having a collition.
since the regular callback system isn't working now i found 2 possible other ways

  1. customize the vtable with the following script

    (function() {
    
    var calledBack = false;
    var callback = new Ammo.ConcreteContactResultCallback();
    
    Ammo.customizeVTable(callback, [{
    
      original: Ammo.ConcreteContactResultCallback.prototype.addSingleResult,
    
      replacement: function(cp, etc) {
    
        calledBack = true;
        console.log('collition')
      }
    }]);
    assert(!calledBack);
    callback.addSingleResult(Ammo.NULL, Ammo.NULL, Ammo.NULL, Ammo.NULL, Ammo.NULL, Ammo.NULL, 
    Ammo.NULL);
    assert(calledBack);
    })();

this doesnt seems to work. at least i expect to have the replacement function to be called everytime a collition is detected. Now it get executed only once upon initialization

  1. retreiving the current manifolds after each step like this:
      scene.world.stepSimulation( 1 / 60, 1, 1/60 );

        var count = scene.world.getDispatcher().getNumManifolds();

        for (var i=0; i < count;i++)
        {
            ///myobjectA.activate();
            ///myobjectB.activate();
            var contactManifold =  scene.world.getDispatcher().getManifoldByIndexInternal(i);

            var obA = contactManifold.getBody0();
            var obB = contactManifold.getBody1();

            if (myobjectA == obA && myobjectB == obB){
                console.log("a and b collided")
            }
            else{
                console.log('nothing')
            }   
        }

unfortunaly the last one is behaving strange. it seems that when for example a ball is rolling in the direction of a box. both the box and the ball become part of the manifolds. Also without ccd this is happening. Normal behaviour?

Anyway i cannot find a way to proper get my collitions. Is there another way? or do i something wrong

Compile Error with `llvm-ld: error: Cannot find linker input 'src/.libs/libBulletCollision.a.bc'`

plee@sos:~/nonrs/git$ cd ammo.js/
plee@sos:~/nonrs/git/ammo.js$ l
total 60
-rw-r--r-- 1 plee plee   195 2012-02-23 12:24 AUTHORS
drwxr-xr-x 2 plee plee  4096 2012-02-23 12:28 builds
drwxr-xr-x 6 plee plee  4096 2012-02-23 12:24 bullet
-rw-r--r-- 1 plee plee   212 2012-02-23 12:24 bundle.py
drwxr-xr-x 3 plee plee  4096 2012-02-23 12:25 examples
-rw-r--r-- 1 plee plee   905 2012-02-23 12:24 LICENSE
-rwxr-xr-x 1 plee plee  6586 2012-02-23 12:24 make.py
-rw-r--r-- 1 plee plee 11515 2012-02-23 12:24 README.markdown
-rw-r--r-- 1 plee plee  1390 2012-02-23 12:24 root.h
-rw-r--r-- 1 plee plee  1879 2012-02-23 12:24 test.py
drwxr-xr-x 2 plee plee  4096 2012-02-23 12:27 tests
-rw-r--r-- 1 plee plee   583 2012-02-23 12:24 wrap.py
plee@sos:~/nonrs/git/ammo.js$ python make.py

--------------------------------------------------
Building ammo.js, build type: ['-O3', '-s', 'DOUBLE_MODE=1', '-s', 'CORRECT_SIGNS=1', '-s', 'INLINING_LIMIT=0']
--------------------------------------------------


==========================
Stage 1: Generate bindings
==========================

Preprocessing...
Cleaning...
Processing...

=======================
Stage 2: Build bindings
=======================


==================
Stage 3: Configure
==================

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... /home/plee/Dev/emscripten/emcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /home/plee/Dev/emscripten/emcc accepts -g... yes
checking for /home/plee/Dev/emscripten/emcc option to accept ISO C89... none needed
checking dependency style of /home/plee/Dev/emscripten/emcc... none
checking whether /home/plee/Dev/emscripten/emcc and cc understand -c and -o together... yes
checking whether we are using the GNU C++ compiler... yes
checking whether /home/plee/Dev/emscripten/em++ accepts -g... yes
checking dependency style of /home/plee/Dev/emscripten/em++... none
checking for a sed that does not truncate output... ../configure: line 4229: echo: write error: Broken pipe
/bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by /home/plee/Dev/emscripten/emcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking how to recognize dependent libraries... pass_all
checking for ar... /home/plee/Dev/emscripten/emar
checking for strip... strip
checking for ranlib... /home/plee/Dev/emscripten/emranlib
checking command to parse /usr/bin/nm -B output from /home/plee/Dev/emscripten/emcc object... ok
checking how to run the C preprocessor... /home/plee/Dev/emscripten/emcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether /home/plee/Dev/emscripten/em++ accepts -g... (cached) yes
checking dependency style of /home/plee/Dev/emscripten/em++... (cached) none
checking how to run the C++ preprocessor... /home/plee/Dev/emscripten/em++ -E
checking for objdir... .libs
checking if /home/plee/Dev/emscripten/emcc supports -fno-rtti -fno-exceptions... yes
checking for /home/plee/Dev/emscripten/emcc option to produce PIC... -fPIC -DPIC
checking if /home/plee/Dev/emscripten/emcc PIC flag -fPIC -DPIC works... yes
checking if /home/plee/Dev/emscripten/emcc static flag -static works... yes
checking if /home/plee/Dev/emscripten/emcc supports -c -o file.o... yes
checking if /home/plee/Dev/emscripten/emcc supports -c -o file.o... (cached) yes
checking whether the /home/plee/Dev/emscripten/emcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ld used by /home/plee/Dev/emscripten/em++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the /home/plee/Dev/emscripten/em++ linker (/usr/bin/ld) supports shared libraries... yes
checking for /home/plee/Dev/emscripten/em++ option to produce PIC... -fPIC -DPIC
checking if /home/plee/Dev/emscripten/em++ PIC flag -fPIC -DPIC works... yes
checking if /home/plee/Dev/emscripten/em++ static flag -static works... yes
checking if /home/plee/Dev/emscripten/em++ supports -c -o file.o... yes
checking if /home/plee/Dev/emscripten/em++ supports -c -o file.o... (cached) yes
checking whether the /home/plee/Dev/emscripten/em++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether byte ordering is bigendian... no
checking BulletMultiThreaded... no
checking for GL/gl.h... yes
checking for GL/glu.h... yes
checking for GL/glext.h... yes
checking for GL/glut.h... yes
checking for main in -lGL... no
checking for main in -lGLU... no
checking for main in -lGLUT... no
checking for main in -lopengl32... no
checking for main in -lglu32... no
checking build mode... optimize
configure: creating ./config.status
config.status: creating bullet.pc
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating Extras/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure:

Please type 'make' to build Bullet


=============
Stage 4: Make
=============

cd .. && /bin/bash /home/plee/nonrs/git/ammo.js/bullet/missing --run aclocal-1.10
/home/plee/nonrs/git/ammo.js/bullet/missing: line 54: aclocal-1.10: command not found
WARNING: `aclocal-1.10' is missing on your system.  You should only need it if
         you modified `acinclude.m4' or `configure.ac'.  You might want
         to install the `Automake' and `Perl' packages.  Grab them from
         any GNU archive site.
cd .. && /bin/bash /home/plee/nonrs/git/ammo.js/bullet/missing --run autoconf
 cd .. && /bin/bash /home/plee/nonrs/git/ammo.js/bullet/missing --run automake-1.10 --gnu
/home/plee/nonrs/git/ammo.js/bullet/missing: line 54: automake-1.10: command not found
WARNING: `automake-1.10' is missing on your system.  You should only need it if
         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
         You might want to install the `Automake' and `Perl' packages.
         Grab them from any GNU archive site.
aclocal.m4:14: error: this file was generated for autoconf 2.61.
You have another version of autoconf.  If you want to use that,
you should regenerate the build system entirely.
aclocal.m4:14: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
WARNING: `autoconf' is probably too old.  You should only need it if
         you modified `configure.ac'.  You might want to install the
         `Autoconf' and `GNU m4' packages.  Grab them from any GNU
         archive site.
/bin/bash ./config.status --recheck
running CONFIG_SHELL=/bin/bash /bin/bash ../configure  --disable-demos --disable-dependency-tracking CC=/home/plee/Dev/emscripten/emcc CFLAGS= CXX=/home/plee/Dev/emscripten/em++  --no-create --no-recursion
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... /home/plee/Dev/emscripten/emcc
checking for C compiler default output file name... a.out.js
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make: *** [config.status] Error 1

=============
Stage 5: Link
=============

llvm-ld: error: Cannot find linker input 'src/.libs/libBulletCollision.a.bc'
Traceback (most recent call last):
  File "make.py", line 157, in <module>
    'libbullet.bc')
  File "/home/plee/Dev/emscripten/tools/shared.py", line 466, in link
    assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
AssertionError: Linking error:

CC @kripken

three.js + "workerized" ammo.js = awesomeness

http://strelz12.cs.usm.edu/physics/

This example has three.js rendering running in the main javascript thread and ammo.js running independently in a webworker

result is a HUGE improvement in performance from a limit of around 40 objects in the single-thread version to as many as a 1000 objects in the "workerized" version.

check it out - more examples to come

strelz

Error with the TOTAL_MEMORY parameter

Hello,

I made a rapid benchmark test file for testing performance with constraints.
When I launch the test, I've this error :

uncaught exception: Assertion: Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ( 20971520), (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.

I think there an error because :

  • ammo was compiled with TOTAL_MEMORY=52428800 (50Mb), not 20Mb ( 20971520)
  • setting TOTAL_MEMORY in the source with Ammo.TOTAL_MEMORY=xxxxxxx doesn't work (always 20 Mb instead 50Mb)

File for test : http://www.stoomm.com/benchconstraint.js (lauch with test.py)

Thanks a lot for your help.

Missing Bullet constants

Hi,

It seems constants are undefined in some (or all) ammo classes. E.g no CF_* CO_* in btCollisionObject or DISABLE_DEACTIVATION in Ammo. How can I extract Bullet constants from C++ and use them in JavaScript?

btWheelInfo missing get_m_raycastInfo()

Was just noting that I can't seem to get to the m_raycastInfo from my btWheelInfo object obtained through btRaycastVehicle.getWheelInfo(x) using myWheelInfo.get_m_raycastInfo(). I've tested and every other available property and function appears to be working correctly.

I'm guessing it's related to the struct-in-struct that's used here:

struct btWheelInfo
{
         struct RaycastInfo
         {
                 //set by raycaster
                 btVector3       m_contactNormalWS;//contactnormal
                 btVector3       m_contactPointWS;//raycast hitpoint
                 btScalar        m_suspensionLength;
                 btVector3       m_hardPointWS;//raycast starting point
                 btVector3       m_wheelDirectionWS; //direction in worldspace
                 btVector3       m_wheelAxleWS; // axle in worldspace
                 bool            m_isInContact;
                 void*           m_groundObject; //could be general void* ptr
        };

       RaycastInfo     m_raycastInfo;
       /// ... snip ...

File size

Ammo.js seems to be the most versatile javascript physics engine out there, but the 1.8 mb file size is unacceptable for most web projects. Are there any plans to try to make the library any more compact?

How to use btTransform function getOpenGLMatrix?

I can't get btTransform's getOpenGLMatrix function to work. Here's what I thought should work:

var m = new Array(16);
transform.getOpenGLMatrix(m);

I've tried various other things, but can't seem to get anything back from getOpenGLMatrix. I can get my code to work if I use getBasis().getRow()... and getOrigin(), and use that to make a matrix, but that seems like a very roundabout way to do it.

(I can't setOpenGLMatrix to work either, but I assume the issue is probably the same, since both functions expect a pointer to a btScalar array in the original Bullet version.)

Differences between closure and no closure for pointer

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.

btKinematicCharacterController is not exposed

I just tried to instantiate a character controller via Ammo and it seems that btKinematicCharacterController is not currently exposed (Ammo.btKinematicCharacterController is undefined).

Can't checkout and build

It seems like I should be able to checkout and build. This is Ubuntu x86_64 11.10, using Clang 3.0 from here: http://llvm.org/releases/download.html

Stage 2: Build bindings

emmaken.py: /home/USER/projects/emscripten/tools/emmaken.py -I../src -include ../../root.h bindings.cpp -c -o bindings.bc
Running: /home/USER/projects/clang+llvm-3.0-x86_64-linux-Ubuntu-11_10/bin/clang++ -I../src -include ../../root.h bindings.cpp -c -o bindings.bc -m32 -U__i386__ -U__x86_64__ -U_
i386 -U__x86_64 -U__SSE_ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUNDING -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -U__STRICT_ANSI__ -nostdinc -I/home/USER/projects/emscripten/system/in
clude -I/home/USER/projects/emscripten/system/include/bsd -I/home/USER/projects/emscripten/system/include/libc -I/home/USER/projects/emscripten/system/include/libcxx -I/home/US
ER/projects/emscripten/system/include/gfx -I/home/USER/projects/emscripten/system/include/net -I/home/USER/projects/emscripten/system/include/SDL -U__APPLE__ -emit-llvm -c
(None, None)

Stage 3: Make

/bin/bash ./config.status --recheck
running CONFIG_SHELL=/bin/bash /bin/bash ../configure --disable-demos --disable-dependency-tracking CC=/home/USER/projects/emscripten/tools/emmaken.py CFLAGS=-g CXX=/home/USER
/projects/emscripten/tools/emmaken.py --no-create --no-recursion
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... /home/USER/projects/emscripten/tools/emmaken.py
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
make: *** [config.status] Error 77

Constructors.

I was just wondering, is it possible to use other constructors of Bullet classes than the first?

For example, the btHingeConstraint. It's got four constructors:

new Ammo.btHingeConstraint (rbA, rbB, pivotInA, pivotInB, axisInA, axisInB, useReferenceFrameA)
new Ammo.btHingeConstraint (rbA, pivotInA, axisInA, useReferenceFrameA)
new Ammo.btHingeConstraint (rbA, rbB, rbAFrame, rbBFrame, useReferenceFrameA)
new Ammo.btHingeConstraint (rbA, rbAFrame, useReferenceFrameA)

(See http://www.bulletphysics.com/Bullet/BulletFull/classbtHingeConstraint.html for full doc.)

The first constructor seems to work (see the ragdoll demo), but nothing happens when I try any other constructor. Did I miss something obvious here?

Build error: Ammo.js by Emscripten on Mac OsX

http://stackoverflow.com/questions/20797266/build-error-ammo-js-by-emscripten-on-mac-osx

Dear All,

Hi, I have the problem to build ammo.js on Mac. ( OS is Maverick ). It doesn't compile C++ code and nothing in bindings.cpp code in /build folder.

I followed the procedure in this project page. Here is the 1st log I got.

==========================
Stage 1: Generate bindings
==========================

Preprocessing...
clang: error: language not recognized: '-x'
clang: error: no such file or directory: 'c'
clang: error: no such file or directory: 'c++'
clang: error: no input files
Cleaning...
Processing...

I know MacOSX includes clang compiler but emscripten guid forced to install llvm compiler from llvm repository. I wonder how I can fix it. Somebody said MacOsX has the issue to run emscripten. But I wonder it is right or not.

======UPDATE=====

I found 'cpp' called Apple's LLVM, not my own built LLVM in make.py file. In make.py file,

Old code

Popen(['cpp', '-x', 'c++', '-I../src', '../../root.h'], stdout=open('headers.pre.h', 'w')).communicate()

Changed code

Popen(['clang++', '-x', 'c++', '-I../src', '../../root.h' ], stdout=open('headers.pre.h', 'w')).communicate()

But still problem happens even I changed make.py. Error messages are below.

==========================
Stage 1: Generate bindings
==========================

Preprocessing...
In file included from ../../root.h:1:
In file included from ../../project/src/btBulletDynamicsCommon.h:20:
In file included from ../src/btBulletCollisionCommon.h:22:
In file included from ../src/BulletCollision/CollisionDispatch/btCollisionWorld.h:80:
In file included from ../src/LinearMath/btVector3.h:21:
../src/LinearMath/btScalar.h:26:10: fatal error: 'math.h' file not found
#include <math.h>
1 error generated.
Cleaning...
Processing...

I wonder how I can fix it.

Custom mesh and softbodies

First of all, many compliments for the awesome work.

Just two questions:

  • is it possible to connect ammo.js physics to three.js imported mesh (e.g. exported from blender)?
  • is it possible to have the so imported mesh as a softbody? Code snippets?

many thanks and again great work!

Corrupted generated ammo.js due to missing *.so files

Using Clang 3.1, an updated clone of emscripten and ammo.js, I successfully generated the file builds/ammo.js.

There was a lot of Clang warnings (see the end of this message), no problem during the stage 3 (Configure) and 4 (Make), but during the stage 5 (Linking), I have the following messages:

/usr/local/bin/llvm-dis: Could not open src/.libs/libBulletCollision.so: No such file or directory

/usr/local/bin/llvm-dis: Could not open src/.libs/libBulletDynamics.so: No such file or directory

/usr/local/bin/llvm-dis: Could not open src/.libs/libLinearMath.so: No such file or directory

Then the content of the stage 6 (emcc) is the following:

=============
Stage 6: emcc
=============

Warning: Applying some potentially unsafe optimizations! (Use -O2 if this fails.)
path.exists is now called `fs.exists`.
path.exists is now called `fs.exists`.
alzathar@ubuntu:~/Downloads/ammo.js.git$ 

I then tried to test the code using the webgl_demo, but in the Firefox Web console, I have an error in the file ammo.js. Moreover, the size of the file ammo.js is only 757kB instead of 1.6MB (size of the file in the Git repository).

I used also the command 'find . -name '*.so' -print' in the folder, but no file was found. In the folder '.libs', I have only '.la' files. I execute 'emconfigure ./configure' in the folder 'bullet' as well as 'emconfigure make' and still, there is no '.so' files.

Is it possible that the mechanism in Emscripten was updated but the Python script for ammo (make.py) was not?

Example of Clang warnings during the stage 2

bindings.cpp:12096:54: warning: 
      'emscripten_bind_btQuantizedBvh__getSubtreeInfoArray_p0' has C-linkage
      specified, but returns user-defined type 'BvhSubtreeInfoArray &' (aka
      'btAlignedObjectArray<btBvhSubtreeInfo> &') which is incompatible with C
      [-Wreturn-type-c-linkage]
BvhSubtreeInfoArray& __attribute__((used, noinline)) e...
                                                     ^
bindings.cpp:12099:44: warning: 'emscripten_bind_btQuantizedBvh__unQuantize_p1'
      has C-linkage specified, but returns user-defined type 'btVector3 &' which
      is incompatible with C [-Wreturn-type-c-linkage]
  ...noinline)) emscripten_bind_btQuantizedBvh__unQuantize_p1(btQuantizedBvh...
                ^
429 warnings generated.

add btKinematicCharacterController?

Hi!

I would love to see btKinematicCharacterController being part of ammo.js. Since many create games out there, including me, this would be a blast to have. Are there any plans on implementing it, and if not, will there be? ^^

Thanks in advance,
Kind regards,
Roman

btDynamicsWorld::setInternalTickCallback() has no effect

I'm trying to get called back on internal ticks, without success. I tried the naive approach:

    dynamicsWorld  = new ammo.btDiscreteDynamicsWorld(...)
    dynamicsWorld.setInternalTickCallback(pretick, this, true)
    dynamicsWorld.setInternalTickCallback(posttick, this, false)
    dynamicsWorld.stepSimulation(1/30, 5)

    function pretick(dw, timeStep)  { /* XXX never called */ }
    function posttick(dw, timeStep) { /* XXX never called */ }

I looked at Callbacks from C++ to JS in tests/wrapping.js, but that doesn't seem to apply in this case, as I'm not replacing a function on an object, just trying to pass JS objects/functions.

I think I can work around not being able to use the worldUserInfo parameter to setInternalTickCallback(), but I do need the callback function to get invoked.

Am I doing something wrong, or is this just not possible right now?

btBvhTriangleMeshShape doesn’t seem to work

The following code fails during the construction of btRigidBody:

var mesh = new Ammo.btTriangleMesh(true, true);
mesh.addTriangle(
    new Ammo.btVector3(0, 0, 0),
    new Ammo.btVector3(1, 0, 0),
    new Ammo.btVector3(0, 1, 0),
    false
);

var shape = Ammo.btBvhTriangleMeshShape(mesh, true, true);
var transform = new Ammo.btTransform();
transform.setIdentity();
var body = new Ammo.btRigidBody(
    new Ammo.btRigidBodyConstructionInfo(
        0,
        new Ammo.btDefaultMotionState(transform),
        shape,
        new Ammo.btVector3(0, 0, 0)
    )
);

The error message is the following:

ammo.js:2355: Uncaught TypeError: Cannot read property 'a' of undefined

Constructor of btConvexHullShape not working as expected

Hello,

I try to get the following code to work:

// retrieve array of position scalars. length % 3 === 0
var positions = this._getMeshPositions(); 
var objShape = new Ammo.btConvexHullShape(positions, positions.length/3);

this.collisionObject = new Ammo.btCollisionObject();
this.collisionObject.setCollisionShape(objShape);

However, no collisions are reported. If I change the objectshape-lines to the following, everything works as expected:

var objShape = new Ammo.btConvexHullShape();
for(var i = 0; i < positions.length; i += 3)
{
    var pt = new Ammo.btVector3(positions[i], positions[i+1], positions[i+2]);
    objShape.addPoint(pt);
}

This is a major performance problem because for large meshes addPoint() is really slow :/
Does someone know a solution to this?

I wrote the exact same code in C++. There everything works like a charme.

Regards,
bobbel

AllHitsRayResultCallback is missing members

AllHitsRayResultCallback has arrays of collision objects, and hit points/normals, instead of the single values like ClosestRayResultCallback.

It seems like they are missing in Ammo.js and you just get access to the values inherited from RayResultCallback.

Missing values:

m_collisionObjects
m_hitPointWorld
m_hitNormalWorld
m_hitFractions

Can't seem to make Ammo.btConvexTriangleMeshShape work properly

The title says it all.
Although there is some dynamics (an object falls), all the rest is simply not happening (interaction with other objects in a normal way).

this is my code:

var triTransform = new Ammo.btTransform();
triTransform.setIdentity();
triTransform.setOrigin(new Ammo.btVector3(0, 3, 0));

var verti = [];

verti[0] = new Ammo.btVector3(-1.5, -.612, -.866);
verti[1] = new Ammo.btVector3(1.5, -.612, -.866);
verti[2] = new Ammo.btVector3(0, -.612, 1.732);
verti[3] = new Ammo.btVector3(0, 1.837, 0);

verti[0] = new Ammo.btVector3(0, 0, 0);
verti[1] = new Ammo.btVector3(1, 0, 0);
verti[2] = new Ammo.btVector3(.5, 0, 1);
verti[3] = new Ammo.btVector3(.5, 4, .5);

var triMesh = new Ammo.btTriangleMesh();

triMesh.addTriangle(verti[0], verti[1], verti[2], true);
triMesh.addTriangle(verti[1], verti[0], verti[3], true);
triMesh.addTriangle(verti[2], verti[1], verti[3], true);
triMesh.addTriangle(verti[0], verti[2], verti[3], true);

var triShape = new Ammo.btConvexTriangleMeshShape(triMesh, true);

this.shape1 = this.localCreateRigidBody(1, triTransform, triShape);

I am programming this in an environment made by schteppe (big ups for that really nice environment) so the motionstate and rigidbody are created in localCreateRigidBody, where a THREE object is linked to this as well.

In the C++ bullet written examples I see them using btHullShape when using the convextrianglemeshshape, this hullshape is missing in Ammo. Maybe this is where the problem lies? Elsewise I am lost...

Greetings Jesse

Latest ammo.js build breaks various online demos

Check out these demos:

https://github.com/schteppe/ammo.js-demos

Updating to the latest ammo.js build (versus the build currently checked into that repo) causes performance to improve significantly but exhibits a number of breakages:

  • Radgoll bodies return position/rotations as NaNs. This only seems to happen when constraints are linking the ragdoll capsules. If the constraints are not added to the physics world, the simulation works (but obviously the character falls to pieces!).
  • The Vehicle demo exhibits some problems. The car and balls that can be shot from the viewpoint pass through the ground object. Also collisions of the balls with the crate stack rarely seem to occur.
  • BoxDemo - collision of balls with boxes/ground is intermittent.

Restitution behaves differently for 'box vs box' and 'sphere vs box'

There are several comments on the Bullet forums referring to different behaviour for restitution in the case where a ball bounces on a static box (versus the case where a box bounces on a static box). For example:

http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6787

I do note that Bullet 2.78 is nearly 2 years old now, and I do wonder whether this is simply a bug that has now been fixed. The first thing I wanted to do was download the latest bullet source (2.81) and compile with Emscripten. I have downloaded and installed Emscripten and I seem to have a valid install.

When I try to execute python make.py for ammo.js (compiling Bullet 2.78) on Mac OS X 10.8.3, I get:

Mac-mini:ammo.js willeastcott$ python make.py 

--------------------------------------------------
Building ammo.js, build type: ['-O2', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0', '-s', 'ASM_JS=1', '-s', 'EXPORT_BINDINGS=1', '-s', 'DEAD_FUNCTIONS=["__ZSt9terminatev","__ZN20btAxisSweep3InternalItE26processAllOverlappingPairsEP17btOverlapCallback","__ZN20btAxisSweep3InternalIjE26processAllOverlappingPairsEP17btOverlapCallback"]', '-s', 'TOTAL_MEMORY=67108864']
--------------------------------------------------


==========================
Stage 1: Generate bindings
==========================

Preprocessing...
i686-apple-darwin11-llvm-gcc-4.2: c: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: c++: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: warning: '-x -x' after last input file has no effect
i686-apple-darwin11-llvm-gcc-4.2: no input files
Cleaning...
Processing...

Therefore, I tried editing make.py to use gcc instead of cpp, and I get:

Mac-mini:ammo.js willeastcott$ python make.py 

--------------------------------------------------
Building ammo.js, build type: ['-O2', '-s', 'DOUBLE_MODE=0', '-s', 'PRECISE_I64_MATH=0', '-s', 'ASM_JS=1', '-s', 'EXPORT_BINDINGS=1', '-s', 'DEAD_FUNCTIONS=["__ZSt9terminatev","__ZN20btAxisSweep3InternalItE26processAllOverlappingPairsEP17btOverlapCallback","__ZN20btAxisSweep3InternalIjE26processAllOverlappingPairsEP17btOverlapCallback"]', '-s', 'TOTAL_MEMORY=67108864']
--------------------------------------------------


==========================
Stage 1: Generate bindings
==========================

Preprocessing...
Undefined symbols for architecture x86_64:
  "btAlignedFreeInternal(void*)", referenced from:
      btAlignedAllocator<int, 16u>::deallocate(int*)  in ccE3CEf1.o
      btAlignedAllocator<btHashInt, 16u>::deallocate(btHashInt*) in ccE3CEf1.o
      btAlignedAllocator<btTriangleInfo, 16u>::deallocate(btTriangleInfo*)in ccE3CEf1.o
  "btTypedConstraint::serialize(void*, btSerializer*) const", referenced from:
      vtable for btTypedConstraintin ccE3CEf1.o
  "std::terminate()", referenced from:
      btHashMap<btHashInt, btTriangleInfo>::~btHashMap()in ccE3CEf1.o
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for btTypedObjectin ccE3CEf1.o
      typeinfo for btHashMap<btHashInt, btTriangleInfo>in ccE3CEf1.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__vmi_class_type_info", referenced from:
      typeinfo for btTypedConstraintin ccE3CEf1.o
      typeinfo for btTriangleInfoMapin ccE3CEf1.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "operator delete(void*)", referenced from:
      btTypedConstraint::~btTypedConstraint()in ccE3CEf1.o
      btTypedConstraint::~btTypedConstraint()in ccE3CEf1.o
      btTriangleInfoMap::~btTriangleInfoMap()in ccE3CEf1.o
      btTriangleInfoMap::~btTriangleInfoMap()in ccE3CEf1.o
  "___cxa_pure_virtual", referenced from:
      vtable for btTypedConstraintin ccE3CEf1.o
  "___gxx_personality_v0", referenced from:
      Dwarf Exception Unwind Info (__eh_frame) in ccE3CEf1.o
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Cleaning...
Processing...

I do get an ammo.js built at the end but it's only about 57KB in length.

If anyone can help me, I'd be very appreciative! :)

Undefined Classes

In the README you state that "Not all classes are exposed, for various reasons". Is there a chance you can compile a list of classes that are not accessible or explain why they are not exposed.

I'm converting a bullet C++ source file to javascript and some classes (i.e. Ammo.btAlignedObjectArray) are returning undefined.

Fast and TA1 Builds

Perhaps I'm missing something obvious but I can't work out how to make those other two builds.

Thanks.

how to use defined string

#define ACTIVE_TAG 1
#define ISLAND_SLEEPING 2
#define WANTS_DEACTIVATION 3
#define DISABLE_DEACTIVATION 4
#define DISABLE_SIMULATION 5

where are these variables

ClosestRayResultCallback not quite working yet

So for an example ray-test of:

var rayCallback = new ClosestRayResultCallback(btRayFrom,btRayTo);
dynamicsWorld.rayTest(btRayFrom,btRayTo,rayCallback);

if (rayCallback.hasHit())
{
    body = btRigidBody.prototype.upcast(rayCallback.m_collisionObject);
    if (body !== NULL)
    {
        console.log("hit");
    } 
}

It appears that .hasHit() isn't a valid function, as well .m_collisionObject never appears to be set so the upcast() always fails as well.

Self-compiled ammo.js is erroneous

I need to modify ammo.js because it lacks an ActionInterface implementation to customize with customizeVTable. Before doing that, I built the library as-is myself and tried it out. It didn't work.

This is the command I used to build ammo: ./make.py -O0. I've uploaded the (gzipped) result here. Here's the test case that fails:

#!/usr/bin/env node
var Ammo = require("./builds/ammo");
var shape = new Ammo.btCapsuleShape(1, 2);
var motionState = new Ammo.btDefaultMotionState();
var bodyCI = new Ammo.btRigidBodyConstructionInfo(0, motionState, shape);
var body = new Ammo.btRigidBody(bodyCI);

To be specific, the last line produces an hell of a stack trace.
To make this work, I added the following line to builds/ammo.js: module.exports = this.Ammo;. This test case fails not only in node, but also in (at least) Google Chrome 18.0.1025.168 m.

Thing is, the ammo.js that I checked out works perfectly. Here's a jsfiddle with the working ammo.js and here with the broken one.

Some details about my build environment:

  • Debian Squeeze, I've tried an apt-get update followed by an apt-get upgrade before executing the make.py

  • uname -sr says Linux 2.6.32-5-686

  • gcc --version says gcc (Debian 4.4.5-8) 4.4.5

  • ~/devel/llvm/build/Debug/bin/clang --version says

    clang version 3.0 (tags/RELEASE_30/final 155985)
    Target: i386-pc-linux-gnu
    Thread model: posix

  • node --version says v0.6.12

  • python --version says Python 2.6.6

  • git rev-parse HEAD in the emscripten directory says a6148681a26f3d41950c8f93a3f25f3ed7c76cd8, which should be the current master

  • git rev-parse HEAD in the ammo.js directory says 36200f52b3383deba7f3a4d7f57ac5870d0e1895, which should also be the current master

Finally, here's my ~/.emscripten.

Help ammo.js student projects

Hi,

I have several students who would like to work on ammo.js related projects this semester

  1. one student wants to investigate why workerized ammo.js runs much slower on Chrome than Firefox or Safari
  2. one student would like to make an example of an ammo.js soft body
  3. one student would like to make an example of an ammo.js rag-doll

any help or pointers would be appreciated - also can you point us to a non-minimized version of ammo.js? Its hard to debug when the program trace disappears into minimized ammo.js code

thanks
strelz

btSweepAxis3 doesn't appear to work

An example of using btSweepAxis3:

var maxProxies = 16384;
var aabbmin = new btVector3(-1000,-1000,-1000); // world size
var aabbmax = new btVector3(1000,1000,1000);

var overlappingPairCache = new btAxisSweep3(aabbmin, aabbmax, maxProxies);

vs.

overlappingPairCache = new btDbvtBroadphase();

results in the following:

Y[v[v[c] + 2]] is not a function @ ammo.js:255

which occurs during a call to:

dynamicsWorld.addRigidBody(body);

Leaving ammo.js running for a long time causes Uncaught Assertion

Hello there. I've been playing with the current build of ammo.js, specifically ammo.ta1.js and ammo.small.js (built from source on Mac OSX). I've noticed that, when running ammo.small.js I can leave the simulation running for some time (1hour +) but eventually the following error occurs:

Uncaught Assertion: Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.

ta1 fails much faster with a similar error (which I will post shortly). Im guessing something is leaking somewhere along the line.

Performance issues with the latest versions of emscripten

Hello,

I find performance issues with the latest versions of emscripten.

Hard to see this problem with the ammo webgl_demo. So, a simple way to test this :

  1. git clone https://github.com/chandlerprall/Physijs.git
  2. launch body.html example. All work well.
  3. replace ammo.js by the last version of ammo.js and launch again the body.html example. You should see the demo is slow with some lags

Also, last versions of ammo are 1.6 or 1.8Mb. Older versions are 1.1 Mb.

I did a lot of tests to help to find the problem. I've check out few commits of emscripten and always build the last version of ammo.js. Some results :

29 may, commit 731ae9d12985230ea05bf174c22771f52d453332 : ammo.js = 1.6Mb. Slower
30 january, commit 9d50dabd93d499f8f059990668c2318d60c5dc1c : ammo.js = 1.1Mb and is ok

Between this 2 commits, I have tests some commits, but some problems appears (problem for build, or build ok but doesn't work, I think is related to issue 22 : #22)

Thanks for your help.

Missing btHeightfieldTerrainShape

Just trying to implement my landscape classes from C++ and noticed the btHeightfieldTerrainShape is missing -- please include it for the next build!

Allow scripting from JS

Compiling code in C++ that uses bullet works fine, but using the compiled library directly from JS is very hard.

  1. Generating a JS API from the low-level LLVM constructs is hard.
  2. Not all the necessary stuff is even compiled - looks like the compiler decides not to compile classes etc. it doesn't need. Also, we have none of the enumerations and #define constants that are useful in C++ code.
  3. To use all LLVM optimizatons and DFE, we need a complete binary, not just a library, or else the optimizer will remove even more stuff we might want.

We need some new tools and ideas here. Or maybe we should just manually write the API in JS. This would give the best results, but take some initial effort.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.