Extremely difficult time with collision checking

Hi there!

I’ve been tracing a problem for a couple weeks and at this point have exhausted every means to track the issue. I made sure I was on the latest Babylon Alpha 28 as well. The following is a link of a project we’ve been pursuing: https://boe-stage.pilotio.workers.dev/ (when in the environment click skip at the top left to enter walk mode).

You can walk the character around nicely. Notice if you try walking off the island or mainland you get blocked by the barrier. We are using a single GLB asset to contain a bunch of meshes and then flagging them as requiring collision detection.

To enable collision we just loop through the GLB mesh list and turn enableCollision on for the mainland_mainLandBorder mesh. Pretty straightforward. We then created a bunch of obstacles throughout the environment to guard the character from interrupting them. We’re using the same method and targeting any mesh in the root of the GLB that has the “_boundary.” in it.

It seems like the border works as expected however the individual ~80 boundary meshes are never detected and so the characters path is never blocked. I’ve recreated a simplified version using the same exact GLBs here: https://playground.babylonjs.com/#DT7AQC#10

Note: that I’ve left the boundary meshes enabled in playground so there’s a visual representation of where they should interrupt the character walk. Use keyboard to change walk direction.

Unfortunately I don’t have a deep understanding of what the issue might be. I’m 95% sure I followed instructions and documented explanations accordingly but have really hit a wall.

@sebavan you’ve been really helpful to me on this project and journey. If you have a moment I’d love your input and guidance.

PS. This is going to be part of a really high visibility project. These boundaries though are driving me a bit crazy.

Thanks in advance.

2 Likes

A bit on the side but have you considered using navmesh to move the characters? This would “simplify” the movement a bit. Creating A Navigation Mesh | Babylon.js Documentation

Also the project is looking really good! :slight_smile:

Hey!

I hope this playground helps - BOSTAGE | Babylon.js Playground (babylonjs.com)

The colliders will need to be a little bigger (well, “higher”) in order for collision to work correctly. Also make sure to play with the ellipsoid and the ellipsoid offset to fit your character needs.

1 Like

@Panuchka thanks! The character movement in that repro isn’t what we actually have deployed. Woah that’s so neat I didn’t know that was an option! Damn I have to try that on the next project. Thanks for the compliment. There’s 4-5 more features to go into now that this issue is covered. We’ll then deploy it into production and share a link here =)

@RaananW oh what the heck. We actually tried multiple versions of the obstacles. The mainland border is much smaller and works correctly. I still don’t totally understand why this makes such a difference. I can see you dynamically scaled the boundaries to fill up more space. Is it that the avatar needs to detect more of the collision boundary or something?

If this is the fix, that’s super annoying.

2 Likes

It is mostly because the collision engine uses ellipsoid vs shapes kind of things. Depending on the speed of your camera the ellipsoid can “roll” over the obstacle (like a ball) so adding higher colliders helps blocking the ball to roll

2 Likes