yaw.ray Posted July 20, 2012 Share Posted July 20, 2012 Hi all, I need build a widget windows to search target ObjectMesh and highlight it in scene, I referenced at sample selection_00: ------------------------ void update_scene() { Object object = NULL; while(1) { Vec3 p0,p1; Unigine::getPlayerMouseDirection(p0,p1); int ret[0]; Object o = engine.world.getIntersection(p0,p1,~0,ret); --------------------- I need a sample how to set data to specific ObjectMesh instead of getPlayerMouseDirection. Because my code doesn't work.... Anyone has any suggestion? Thanks a lot... Link to comment
steve3d Posted July 21, 2012 Share Posted July 21, 2012 Your code don't work because you use while without wait, you can remove while and put this into update function it will ba called on every frame. Link to comment
carl.sutton Posted July 23, 2012 Share Posted July 23, 2012 Your code seems incomplete with an unclosed while loop, so I would drop that. To access ObjectMesh specific functions use; Vec3 p0,p1; Unigine::getPlayerMouseDirection(p0,p1); int ret[0]; Object o = engine.world.getIntersection(p0,p1,~0,ret); if(o != NULL) { if(o.getType() == NODE_OBJECT_MESH) { ObjectMesh objM = node_cast(o); //Do something with objM } } Link to comment
yaw.ray Posted July 31, 2012 Author Share Posted July 31, 2012 Ohhh, I just paste part of code first 6 lines from sample code lib for explain. Issue has been solved by using getNode(). Thanks all. Link to comment
Recommended Posts