GithubHelp home page GithubHelp logo

Comments (15)

 avatar commented on August 17, 2024

I'm having the same issue. It says setInternalTickCallback is supposed to take a 'btInternalTickCallback':
http://bulletphysics.org/Bullet/BulletFull/btDynamicsWorld_8h.html#ab9ff268d3f8e17f20d6bcd7a7ef354c5

Ammo.btInternalTickCallback is undefined...

from ammo.js.

cschinko avatar cschinko commented on August 17, 2024

Any news regarding this issue?

from ammo.js.

kripken avatar kripken commented on August 17, 2024

I hope in the next few weeks to have a new version of ammo that uses a new
bindings generator, which should help with things like this.

On Thu, Apr 17, 2014 at 4:15 AM, cschinko [email protected] wrote:

Any news regarding this issue?


Reply to this email directly or view it on GitHubhttps://github.com//issues/30#issuecomment-40703726
.

from ammo.js.

Usnul avatar Usnul commented on August 17, 2024

this seems to be axed entirely in the new build, can we bring it back please?
by the way, for those still searching, you need to first create a function pointer to pass in:

function callback(dw,timeDelta){
...
}
var fp = Ammo.Runtime.addFunction(callback);
dynamicWorld.setInternalTickCallback(fp);

also, you might need to go into your ammo.js and search for "functionPointers" then change value from "[]" to "new Array(x)" where x is number of pointers you wish to be able to hold, if this isn't done you will likely see an error in console when trying to invoke "addFunction".

from ammo.js.

kripken avatar kripken commented on August 17, 2024

Adding this to the new IDL files seems to require support for passing in function pointers, which I don't think we support yet. But shouldn't be too hard to add.

from ammo.js.

 avatar commented on August 17, 2024

Any word on how to do this with the new IDL? I'd like to create a btInternalTickCallback to handle kinematic rigidbodies, since nothing I do will prevent dynamic rigidbodies from passing through fast moving kinematic rigidbodies (A and D to move the kinematic flippers, hold space to shoot the ball https://goote.ch/169f43e6e96e434d879039deede2bb7e.scene). Even if we were to create an interface for setInternalTickCallback() in the btDiscreteDynamicsWorld class, how would we be able to pass in a JavaScript function?

from ammo.js.

Usnul avatar Usnul commented on August 17, 2024

Just a note, you can still do this, but you need to bypass IDL however, you will need to edit generated C files by hand. If you really need this then a gap-stop solution might work for you.

from ammo.js.

cybafelo avatar cybafelo commented on August 17, 2024

Hey all - I'm also struggling with this - is there some way to set a substep callback in ammo js? I really need this to speed up my game, and I don't want to write any gap-stop code..

from ammo.js.

cybafelo avatar cybafelo commented on August 17, 2024

Hey guys - any feedback on this - is it a simple thing? I don't know the details of emscripten but will try to build a new version of ammo soon - so that I could at least set an internal substep callback - or can someone tell me know if I should not even try this?

from ammo.js.

Usnul avatar Usnul commented on August 17, 2024

@cybafelo
I did this in the past, might try to find it later. But it boils down to generation of C files from IDL that comes with ammo, IDL generator does not allow expression of interface such as one you describe, so you will have to edit generated C file by hand to add it, the rest is simple - just follow build process as usual.

from ammo.js.

cybafelo avatar cybafelo commented on August 17, 2024

ok - I tried the following - i modified the ammo.idl to have the following lines:

callback btInternalTickCallback = void (btDynamicsWorld world, float timeStep);

the float above should actually be btScalar but i didnt want to modify the idl too much (also btScalar is just a typedef for float or double)

then, in interface btDynamicsWorld i added the following line

void setInternalTickCallback(btInternalTickCallback cb, optional VoidPtr worldUserInfo, optional boolean isPreTick);

Now I rebuild ammo.js with python make.py, which builds a temp.js which I copy over to my ammo.js - it loads fine, everything still works - i have the function 'setInternalTickCallback' - but my callback doesn't execute (its a closure, ex.
myDiscreteDynamicsWorld.setInternalTickCallback( function(){ console.log('hello'); } );
I tried the example above with Ammo.Runtime but Ammo.Runtime is not defined. Help anyone?

So - it appears to be the same problem, setInternalTickCallback has no effect

my last attempt is

this.world.setInternalTickCallback( function(__a, __b) { console.log('internal tick callback'); } , null, true);

this.world is an instance of btDiscreteDynamicsWorld

from ammo.js.

Usnul avatar Usnul commented on August 17, 2024

@cybafelo
it was a long time ago since i did this. However, reading my posts here - it appears that editing IDL will not work. I have been suggesting editing C files that are generated from the IDL. I'm sorry, but I can not help you further.

from ammo.js.

MackeyK24 avatar MackeyK24 commented on August 17, 2024

Hey guys... I tried every thing listed above...

tried both 10 and 20 (make.py)

  emcc_args += '-s RESERVED_FUNCTION_POINTERS=10'.split(' ')

But i have NO Ammo.addFunction and/or NO Ammo.Runtime.addFunction

Anybody know what gives ???

from ammo.js.

modstorm avatar modstorm commented on August 17, 2024

Do you have this arg included, it fixed it for me?

-s EXPORTED_RUNTIME_METHODS=[\'addFunction\']

from ammo.js.

MackeyK24 avatar MackeyK24 commented on August 17, 2024

Thats weird... I could not get EXPORTED_RUNTIME_METHODS to work with Pointers_stringify

But luckily there is a EXTRA_EXPORTED_RUNTIME_METHODS that worked for me:

Update make.py

EMCC_ARGS:
emcc_args += '-s RESERVED_FUNCTION_POINTERS=20'.split(' ')
emcc_args += '-s EXTRA_EXPORTED_RUNTIME_METHODS=["addFunction"]'.split(' ')

from ammo.js.

Related Issues (20)

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.