Jump to content

[SOLVED] Search ObjectMesh in scene


photo

Recommended Posts

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

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
×
×
  • Create New...