Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I notice the mesh bounding box doesn't match the mesh itself once the mesh is moved. There is an offset for some reason - particularly noticed once an object is rotated on an axis like a door - its bounding box no longer is detected correctly using the "ccbDoesLineCollideWithBoundingBoxOfSceneNode". I was hoping to do a simple thing like open a door and detect objects inside a fridge but its picking up the door even after its been opened. 30 deg, no good, 60 deg, bit better, 90 deg seems ok then but didnt want to open it 90 degrees... I wish a detection could be made for the mesh vertices itself but this has been mentioned before. Any suggestions to fix this anyone ? even using 2d planes have this issue... |
||||
|
Robo, I uploaded a small project that contains a rotating door in this subfolder "Rotating door" inside my online CCB shared folder https://1drv.ms/u/s!AjokN1FU3jK1... It would be interesting to verify if that problem of wrong bounding box occurs with the mesh included in that project. |
||||
|
hi marcw, yes, the bounding box is around 45 degrees offsett from the actual 3D mesh. It doesn't seem to affect the outer edge of the door so much (near door handle) as to the inner edge (near the hinges)...This is where I find an issue when selecting items inside the fridge near to the hinges as the door is opened I get issues unless its opened all the way.. see here: http://lasttrump.net/Downloads/2021-01-12-rotating-door.ccb |
||||
|
Hi Robo, Thank you for sharing that special behavior with us. I enjoyed spending more time to understand that difficult built in command "ccbDoesLineCollideWithBoundingBoxOfSceneNode(node, startX, startY, startZ, endX, endY, endZ)". Is there a bug, is there a solution ? I cannot answer. However I uploaded a new project combining yours and mine with additional scripts that could perhaps help to decrypt the process of that command. new CCB file "2021-01-13-rotating-door-bounding-box-analysis.ccb" uploaded in the same subfolder mentioned in my previous comment. In that project, it is with the camera1 that the placement of the mouse is defined. Cameras 2 and 3 are static; they show the position and target of the camera 1 and the active position of the mouse. The position of the mouse shown with cameras 2 and 3 is not useful. I hope you could find the perfect solution. |
||||
|
I somehow missed this post and now when I was searching some threads on forums this comes in the search result and thought that maybe if I can provide an answer to your question @Robo here is what you can try after rotating or moving a scene node if its bounding box is not appearing correctly then you might need to use the command ccbUpdateSceneNodeBoundingBox(node)this command updatehttps://www.ambiera.com/forum/images/submitquick.pngs the bounding box of the node if its geometry changes and am not sure but I think Rotation in coppercube actually rotates the geometry. just like moving the object using polygon tools actually moves the geometry of the object that is why scenenode bounding box needs an update. I never tried that by myself but I think that it might work. |
||||
|
Appreciate the help just_in_case but didnt seem to do anything. I tried my rotating door with a 'when pressed a key' run the code you gave. I didnt see any changes anywhere but always good to try stuff...cheers |
||||
|
yeah, I thought if it can help, I will take look into this topic when I get time. |
|