physx-js-webidl icon indicating copy to clipboard operation
physx-js-webidl copied to clipboard

Running as node.js server

Open EibrielInv opened this issue 3 years ago • 4 comments

Hi!

I'm looking to run the library on Node for the server of a game, but I'm running with issues: self or document not defined on lines 189 and 191

I'm not able to set the correct combination of ENVIRONMENT variables :

// Determine the runtime environment we are in. You can customize this by
// setting the ENVIRONMENT setting at compile time (see settings.js).

var ENVIRONMENT_IS_WEB = false;
var ENVIRONMENT_IS_WORKER = false;
var ENVIRONMENT_IS_NODE = true;
var ENVIRONMENT_IS_SHELL = false;

What should I do to run the library on a Node script, in the command line?

EibrielInv avatar May 20 '22 15:05 EibrielInv

I think you have to recompile the library to use it with Node. It should be enough to follow the Build Instructions and change the emscripten environment mode to node before executing the generate and build steps.

To change the environment mode you have to edit the cmake script PhysX/physx/source/compiler/cmake/emscripten/PhysXWebBindings.cmake. In line 49 the ENVIRONMENT is set. I assume you have to change web to node here. I never tried this though.

fabmax avatar May 20 '22 16:05 fabmax

Thanks, will give it a try

EibrielInv avatar May 20 '22 16:05 EibrielInv

Can anyone please provide any updated info on this subject? I just set up a linux VM for the sole purposes of trying these steps. I was able to build with docker but I get Error: environment detection error at runtime.

JohnnyStreet avatar Jan 10 '23 19:01 JohnnyStreet