Closed JohnnyStreet closed 1 year ago
emscripten handles enums in a pretty awkward way: The values are not encapsulated in separate objects but exposed directly by their names (e.g. PhysX.eSCENE_QUERY_SHAPE
). However, this way, values with the same name of different enums can collide and the values overwrite each other, so you should not use these.
The best way is to call the internal wrapper functions instead:
PhysX._emscripten_enum_PxShapeFlagEnum_eSCENE_QUERY_SHAPE();
I opened an issue regarding this a while ago but it never got fixed.
Maybe it's because I am using typescript (with generated typescript definitions) but I don't have _emscripten_enum_NameSpaceA_EnumA_SomeValue() which is what I was using before, in a commonjs project that I got working some months back.
EDIT: My fault. This appears to happen when referencing it as an import before calling Physx(). Closing.
I noticed more of the enums are exposed in recent updates. Everything compiles fine with the changes I made but, when referencing enums like PhysX.PxShapeFlagEnum.SCENE_QUERY_SHAPE for example, I get
Cannot read properties of undefined (reading 'SCENE_QUERY_SHAPE')