Jump to content

[SOLVED] Unigine Sim C++ API coordinates


photo

Recommended Posts

Добрый день!

 

Такая проблема: работаем с Sim версией движка, нужно в плагине получать BoundBox и BoundFrustum, но все их функции принимают vec3, а не dvec3. Какие могут быть варианты решения?

 

Спасибо.

 

Hello.

 

I have a problem: I use Sim version of engine and I need to get BoundBox and BoundFrustum in plugin, but all functions of those classes accepts vec3 parameters instead of dvec3. How I can solve this problem?

 

Thanks.

Link to comment
  • 2 weeks later...

Hello, Sergey!

 

Sorry for late reply.

 

There is a couple of ways you can get bounds in double precision:

 

1) Get local bounds in float via getBoundBox/Sphere/Frustum call, get node world matrix in double precition and transform local bounds properly;

2) Get world bounds in double via getWorldBoundBox/Sphere/Frustum call.

Link to comment

Thank You!

And I have another problem: I need to add vertex to ObjectMeshDynamic in plugin, I get dvec3 vertex from my function, but addVertex accepts only vec3.

Link to comment

Mesh vertices cannot be specified in double precision as the underlying API's only support float. Therfore you have to cast double to float,

Link to comment

Mesh vertices are stored in local coordinates and float only as they transfered to the GPU. If you want to add a world vertex to ObjectMeshDynamic then you need to transform world vertex coorditantes to local and then convert double to float (might be huge troubles with precision during this step).

Link to comment
×
×
  • Create New...