Coppel.Damien Posted June 18, 2018 Share Posted June 18, 2018 (edited) Hello, I encountered something weird manipulating BoundingBox with UnigineScript, here's the code part reproducing the problem : BoundBox bb = node.getBoundBox(); //bb.setTransform(mat4(node.getTransform())); vec3 p1 = bb.getMin(); vec3 p2 = bb.getMax(); engine.visualizer.renderPoint3D(Vec3(p1), 0.1, vec4(1, 0, 0, 0.5), 0); engine.visualizer.renderPoint3D(Vec3(p2), 0.1, vec4(1, 0, 0, 0.5), 0); engine.visualizer.renderNodeBoundBox(node, vec4(0, 0, 1, 0.5)); (The code has to be run with engine.visualizer.setEnabled(1); called, and a valid node instance loaded). The visualizer part shows on my program 2 random points (red ones), not matching with any of the bounding box points (rendered in blue). The commented line solves the problem if uncommented., so I think the transform matrix of the node is not assigned by default to the bounding box, which might look like a bug. Thank you. EDIT : By the way, the setTransform() method is not referenced (but still usable) in the UnigineScript doc. Edited June 18, 2018 by Coppel.Damien Link to comment
silent Posted June 19, 2018 Share Posted June 19, 2018 Hi Damien, Could you please give some additional details about this - what you are trying to achieve with that code? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Coppel.Damien Posted June 19, 2018 Author Share Posted June 19, 2018 (edited) Hello, thank you for your reply. I am picking the bounding box of a node, then I display it and the 2 points obtained with getMin() and getMax() method. I was surprised to see that the rendered points do not match with any of ones from the bounding box. I noticed that adding the commenting line (setTransform(mat4(node.getTransform()))) solves the problem. It may be an intended behavior, but I prefer signaling it. Here are two screenshots showing the problem : Expected result, obtained with setTransform. Result without setTransform : Edited June 19, 2018 by Coppel.Damien Link to comment
andrey-kozlov Posted June 19, 2018 Share Posted June 19, 2018 Hello Damien, Method getBoundBox returns bounding box in node's local coordinate system (and engine.visualizer.renderPoint3D expects world's coordinates). If you want to get bounding box in world's coordinates you should use getWorldBoundBox Link to comment
Coppel.Damien Posted June 19, 2018 Author Share Posted June 19, 2018 (edited) Hello, ok I didn't understand this from the doc, thanks a lot. Edited June 19, 2018 by Coppel.Damien Link to comment
fox Posted June 20, 2018 Share Posted June 20, 2018 Hi Damien! The documentation was also updated and will be available with the upcoming release, sorry for the inconvenience caused! Thanks! Link to comment
Recommended Posts