shaopeng.chen Posted September 21, 2017 Share Posted September 21, 2017 I want to detect trees in the scene。 However the tree type is ObjectMeshClutter, how can detect them? when I use this code to detect. int result = engine.world.getIntersectionObjects(ttP0,ttP1,ret); //int result = engine.world.getIntersection(ball_boundBox,-1,ret); if(result != 0) { if( ret.size()!= 0) { log.message("------------------------------------------------------------------------%d\n",ret.size()); int exclude[0]; exclude.clear(); Node nearest = NULL; forloop(int i = 0; ret.size()) { Node n = node_cast(ret[i]); if(n != NULL && n.getTypeName() == "ObjectMeshClutter"){ log.message("hit name: %30s -> %s %s %s\n",n.getName(), n.getTypeName(),typeinfo(ttmp.getWorldPosition()))); } } log.message("------------------------------------------------------------------------\n"); } } the result is: hit name: spruce1_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: blooming_sally_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: tormentil_dead_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: blooming_sally_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: camomile_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: stone3_color3_mesh_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: ledum2_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: blooming_sally_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: blooming_sally_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: camomile_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: tormentil_dead_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: birch1_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: tormentil_dead_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: blooming_sally_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: camomile_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: blooming_sally_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: tormentil_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: ledum_dead_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: ledum2_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: stone3_color3_mesh_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: spruce1_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) hit name: tormentil_flowers_clutter -> ObjectMeshClutter dvec3: -4096 -4096 0 dmat4: (1 0 0 0) (0 1 0 0) (0 0 1 0) (-4096 -4096 0 1) So I'm confused,how to detect nodes that whose type is ObjectMeshClutter bewteen two point. Link to comment
silent Posted September 23, 2017 Share Posted September 23, 2017 Hello! I'm afraid, it's not possible to intersect with single tree from ObjectMeshClutter. In 2.6 we will add couple of methods to API that will allow you to get all transformation matricies of all rendered on screen objects in clutter. That probably, can help a bit in some cases. 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
shaopeng.chen Posted September 23, 2017 Author Share Posted September 23, 2017 On 2017/9/21 at 8:58 PM, shaopeng.chen said: ObjectMeshClutter Thank you very much. I know PlayerActor can't move through the tree whose type is ObjectMeshClutter , so how can I move a camera like PlayerActor ? Link to comment
silent Posted September 25, 2017 Share Posted September 25, 2017 You can move PlayerActor if you will remove collision flag from clutter. Or you can use PlayerSpectator for this task. 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
Recommended Posts