But the result is quite unexpected. The player is able to stand in the empty space in the centre and also for as far away from the track as I tried to go. The player would never fall off.
Is there any way to fix/debug this? Thanks!
Adding a box collider works as expected, but then the empty space at the center of the track also has collision. Using the renderPhysics script along with mesh collision, it render all the other collisions, but not the track’s collision…
It’s weird that the bounds of the box collision is correct but not a mesh
The code you have looks correct. Does this work in the Editor (I know you are engine only but want to check if it could be a setup issue or potentially an engine issue)
It looks like you’re providing the asset resource instead of just the asset. If you provide the asset id as a number or just the asset object itself, does it start working?
I wonder if it’s a unit problem during the export to GLB. I noticed that in your example projects, they have to be scaled up to 100 times when in mine, I don’t have to scale at all to get the same size?
The other thing I noticed is that when you imported the the OBJ into PlayCanvas Editor, it created a single render asset. In the GLB, this is what it looks like:
I couldn’t find any such option in the Three JS editor so I tried to export it to blender but the option was missing over there as well.
So I tried to scale the model on the X and Z axes within the Three JS editor, and then export it. And I also removed: track.setLocalScale(10,10,10);
from my code and the collisions started working as expected! (Although now it feels a bit bumpy sometimes, but that’s another issue)
So I think this was the issue.
Hmm… both those files were exported from the same ThreeJS scene, so I’m not sure why it’s different. In the ThreeJS editor I see the entire complicated heirarchy.
You can merge two objects in Blender using the Boolean modifier. Select one object, add a boolean modifier, point to the next object, apply modifier. Repeat for next piece.