eventMask is a number. An acceptable value for eventMask is EventType.COLLISION_STARTED.value. However, we cannot use .value in TypeScript unless we use // @ts-ignore
Is there a way we can use HP_Body_SetEventMask() in TypeScript without // @ts-ignore? Thanks!
The .d.ts types file suggests that EventType.__ is an enum/number. However, on the JS side after loading Havok, EventType.__ is actually an object of type { value: number }
It’s true that you will get no TypeScript errors by omitting .value. However, collision callbacks will not fire if .value is omitted. This is why the Babylon.js source code uses .value
I hope that the Babylon.js team could consider a change so that we don’t need to use a workaround. @RaananW@Cedric I’m curious to hear your thoughts on this when you have time. It seems like there are 2 approaches for a solution:
On the JS side: Make EventType.COLLISION_STARTED a number instead of an object of type { value: number }
On the TS .d.ts side: Expose .value on EventType somehow