vincent / recast.js

A wrapper for the RecastDetour navigation library for node and the browser
http://vincent.github.io/recast.js/tests/test.webgl.html
107 stars 21 forks source link

Callbacks: cannot convert "function ..." to int #17

Closed zenithlight closed 9 years ago

zenithlight commented 9 years ago

Hey, I seem to be running into a weird problem with this library. I am using the node package recastjs. When using a function that accepts a callback, it says cannot convert "function ..." to int, where function ... is the callback that was given. The exception is the OBJStringLoader, which ran and ran the callback without any problem. Any idea what might be causing the issue?

vincent commented 9 years ago

hi. are you using the webworker or plain version ?

in any case, you can use recast.cb(function) to get a "named" callback like here https://github.com/vincent/recast.js/blob/master/tests/test.pathfinding.js#L31

this is because we cannot pass functions to Emscripten runtime.

zenithlight commented 9 years ago

The plain version (I think), it's what is returned by performing require('recastjs'). Thank you, recast.cb worked like a charm. Is there any way to get a callback that the navmesh is finished building?

vincent commented 9 years ago

It seems I forgot this. I'll add it.

Anyway, as you use the plain version, buildSolo() and buildTiled() are blocking :-)