Mesh intersection problem (v5.0.0-beta.5)

Hi! I think that there is some bug in the mesh intersection detection if you change mesh pivotmaterix position. It works fine with Babylon 4.2.1 but with 5.0.0-beta.5 there are some problems.

Here is a test scene that demonstrating the problem when dragging red box near walls. Gray helperbox should follow this red box if it doesn’t intersects with walls:

EDIT (=new playground link):
https://playground.babylonjs.com/#LTWRV7

Hey,

i’ll look into that. Should be working correctly, of course :slight_smile:

2 Likes

Hi Jukka,

I must be missing something fundamental… The playground you shared has nothing to do with collisions and has no walls. Is that the right playground?

You are absolutely right - my bad!!! :upside_down_face: I copy/paste the wrong playground link first, but now it’s updated. And i put it here also:
https://playground.babylonjs.com/#LTWRV7

Oh I think it might be cause at the time of the drag event the pivot has been unset. Adding @Cedric to double check cause if I remember well there were some tricks lately to allow correct drag behavior and pivots ?

After moving the check to onBeforeRenderObservable and calling computeWorldMatrix before intersectsMesh, then it seems to be detecting the intersection correctly, in case that helps narrow the issue down more… :slight_smile:

2 Likes

Yes you remember right, i had problems with PointerDragBehaviour/dragPlane when using Babylon 5.0.0-beta.4 but @Cedric fixed it and now it works correctly with 5.0.0-beta.5.

2 Likes

This trick seems to work - thank you @Blake!

2 Likes

Hi! I would have asked if a final solution to this problem has yet been found? In the latest version v5.0.0-rc.0, the problem seems to still exist. @Blake 's example works as a workaround but I think that it doesn’t solve the exact bug?

cc @Cedric ?

Let me take a look.

2 Likes

PR Fix matrix update with pointerDragBehavior and Pivot by CedricGuillemet · Pull Request #12100 · BabylonJS/Babylon.js · GitHub

2 Likes

Hi! Did i understand correctly that this bug has been fixed in this latest version 5.0.0-rc.3? For some reason my playground scene still working ”wrong way” as before with all versions 5.x but correctly with version 4.2.1.

It should be working now, could you share the playground not working back for @Cedric to have a look ?

Well now it’s indeed working - thanks guys!!! :pray:

I tested this PG example yesterday and it didn’t work yet and still PG showed version 5.0.0-rc.3.

Btw how those versions go in BabylonJS - are there some intermediate versions when the actual version number isn’t changed at all? Sorry I’m a rookie with your framework and still learning how things work :grinning:

We deploy daily on the CDN and kind of bi weekly on npm :slight_smile:

1 Like

Ok thank you @sebavan for clarification! :+1: :slightly_smiling_face:

1 Like