Closed RomStef closed 6 years ago
Could you attach a little example?
I could not reproduce this bug on linux with:
mesh = …
mesh.constructBvh().overlap(mesh.constructBvh())
with no example , i have try just like the mathutils BVHtree :
""" import bge import mathutils
water = bge.logic.getCurrentController().owner terrain = bge.logic.getCurrentScene().objects['terrain']
waterMesh = water.meshes[0] terrainMesh = terrain.meshes[0]
waterBVHTree = waterMesh.constructBvh terrainBVHTree = terrainMesh.constructBvh
overlappedFacesList = terrainBVHTree.overlap(waterBVHTree) overlappedFacesList.sort()
print(overlappedFacesList) """
where water and terrain are two intersected planes
i have missed the brackets , sorry
Sorry, i have to return on this issue because the overlap function work but don't return any value. here an example : [Uploading test_bvh_overlap.zip…]()
@RomStef : the file link seems incorrect.
The BVH is construct from the mesh and can't include the object transformation because meshes are shared. In your example file, the water plane have a transformation and without it it doesn't intersect the ground. Applying the location on the plane mesh is fixing the issue.
Though a lot of people will encounter this issue, @RomStef, @BluePrintRandom: Do you think interesting to pass a matrix to constructBvh
to represent the object transformation ?
@RomStef, @BluePrintRandom ?
Maybe a bool, world or local?
when the tree is built, decide on world or local?
alternatively we just localize the transform of the input to object space.
local = object.worldOrientation.inverted()* ( point - object.worldPosition)
The mesh can't get a world transform as it is shared across objects, I will make PR tonight for passing a matrix.
Strange, but in my case, seems, player and some cubes intersect always, regardless they don't actually intersect.
Example: https://www.youtube.com/watch?v=4Lsk84Gb9TY
Here you see, that BVHTree always says that there are some intersected faces, but if you'll look to coordinates, than you'll see that they'll be the same only when I jumped on one of that blocks.
Can somebody tell me, what I'm doing wrong ?)
Are you transforming the bvhtree to the correct world space?
On Thu, Nov 29, 2018, 6:58 PM Vladislav <notifications@github.com wrote:
Strange, but in my case, seems, player and some cubes intersect always, regardless they don't actually intersect.
Example: https://www.youtube.com/watch?v=4Lsk84Gb9TY
Here you see, that BVHTree always says that there are some intersected faces, but if you'll look to coordinates, than you'll see that they'll be the same only when I jumped on one of that blocks.
Can somebody tell me, what I'm doing wrong ?)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/UPBGE/blender/issues/786#issuecomment-443073995, or mute the thread https://github.com/notifications/unsubscribe-auth/AG25Wcq73llyhW68EiViKk2fBLFWZPsnks5u0J7ngaJpZM4V4bTa .
@BluePrintRandom , ah, no. Thanks ) I missed that, I thought, that it was fixed in PR to account that transfor automatically =)
as i said in the title , when i call the overlap function of BVHtree for testing overlapped faces between two different BVHtree the programm says the object has no attribute 'overlap'