Jump to content

C++ ObjectMeshDynamicPtr::getIntersection.


photo

Recommended Posts

Posted

hi, bug in subj:

 

 

int ret_surface = -1;

vec3 rpt;

// VARIANT 1:

if(obj->getIntersection(pt1, pt2, ~0, &rpt, NULL, NULL, NULL, &ret_surface)) {...}

 

// VARIANT 2:

if(obj->getIntersection(pt1, pt2, ~0, NULL, NULL, NULL, NULL, &ret_surface)) {...}

 

variant 2 gets bug - incorrect surface detected.

Posted

Hi Sergey,

 

Is it possible to reproduce such behavior with <SDK>\source\samples\Api\Nodes\Objects sample? I've tried to call getIntersection() diffrent ways and always get correct results.

 

Could you please give us more details or provide a simple test scene for reproduction?

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

  • 4 weeks later...
Posted

<SDK>\source\samples\Api\Nodes\Objects - there is one-surface model, i used multi, with Unigine::ObjectMeshDynamicPtr

Posted

Hey Sergey,

 

Could you also please tell us which version of the engine do you use?

Posted

Unigine 2.0 alpha

Binary: Windows 32bit Visual C++ 1600 Release Oct 9 2014 r15975

Posted

Hi Sergey!

 

I had a look inside engine's ObjectMeshDynamic::getIntersection code and here's what I found (spoiler, it's not a bug).

 

if you don't pass pointer to position then this method is supposed to be used only for intersection checking without getting any data from it. The algorithm will stop on the first triangle (not the closest one) that intersects the ray in that case.

 

So I recommend you just to pass some pointer to temporary variable even if you don't want to use position data.

×
×
  • Create New...