Babylon.js: Strange behavior intersectsMesh()

Created on 25 Dec 2017  路  17Comments  路  Source: BabylonJS/Babylon.js

This is your example https://www.babylonjs-playground.com/#C72JLZ#1

Please go to string number 68. Open console and see! At first it will print as expected! but if you replace the parameter as indicated in the comments, you'll see that the first works - "after", and only once.

Just watch when and what parameters are output in the console! When changing from truth to false and vice versa.

The same strange behavior occurs in other balls, if you change this BABYLON.Mesh.CreateBox to this BABYLON.MeshBuilder.CreateBox

question rendering engine

All 17 comments

Hello actually I do not see the problem :(

It changes when interacting with the mesh:
https://www.babylonjs-playground.com/#C72JLZ#2

image

deepinscreenshot_select-area_20171226202154
It should not be!

It should :) the ball starts in a position where it is not in collision

Change the position of the ball! And everything will remain the same!

Not sure to follow you. THe test is about checking if the ball intersects the plane. If you move it to a position where it does not intersect then the message will be written.
Perhaps the text should be changed to "no intersection" instead of "after"

IN your opinion, the animation starts with the fact that the ball collided with the ground? Regardless of where the ball is, the first animation is such!

pos 1: Ball has not yet collided with the ground , but in the picture he has already faced
pos 2: The ball is approaching the earth!

deepinscreenshot_select-area_20171226203403

https://www.babylonjs-playground.com/#C72JLZ#3

Ball starts at a position where there is no intersection with the plane:
image

So this is correct:
image

https://www.babylonjs-playground.com/#C72JLZ#4

Look at this example. Do the ball has already collided with the earth? Of course not! but in the picture the first picture shows that the collision occurred!

Your picture suggests that the ball in the first frame collided with the ground! But really it's not!

ok I see it now :) will fix it!
Thank you !

change state issues - unable to reproduce

yes my lord!

)))

So it is not a bug actually :)
https://www.babylonjs-playground.com/#C72JLZ#5

I fixed it by using registerAfterRender. The point is we need the meshes to update their bounding info which is done automatically during render

Other way to fix it:
https://www.babylonjs-playground.com/#C72JLZ#6

you manually update the matrices

Yes!)) It is elementary)) registerAfterRender and registerBeforeRender! Please, sorry me! Thank you!

No problem :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nbduke picture nbduke  路  21Comments

PatrickRyanMS picture PatrickRyanMS  路  18Comments

fmmoret picture fmmoret  路  28Comments

innerground picture innerground  路  59Comments

deltakosh picture deltakosh  路  17Comments