About Store Forum Documentation Contact



Post Reply 
DestructMesh element out of range
Author Message
Mardok Offline
Member

Post: #1
DestructMesh element out of range
Hi Greg,

Probably i found bug in:
Code:
DestructMesh& create(Mesh &mesh, Int cuts, C MaterialPtr &material, Flt tex_scale=1, Int phys_vtx_limit=-1, Bool cut_affects_biggest_part=true, Bool simple_cuts=false);

This method sometimes generate parts out of range, for example if we want 8 cuts, function generate 7 or 9 parts. This occurs randomly maybe one in ten cases or sometimes when i try build and test my application i see Error: _inline.h line 149

You can run this sample code which trying to create destruct mesh until generated parts parts will be different from defined cuts limit.

Code:
DestructMesh mesh_destruct;
MeshPtr      mesh;
bool         stop = false;
int          counter = 0;

void InitPre()
{
   EE_INIT();
  
   Physics.create(EE_PHYSX_DLL_PATH);
}

bool Init()
{  
   mesh = ObjectPtr(UID(1134879343, 1157937325, 4232119955, 3140023117))->mesh();
  
   return true;
}

void Shut(){}

bool Update()
{

   while(!stop)
   {
      mesh_destruct.del();
      mesh_destruct.create(*mesh, 7, UID(2469699354, 1312990749, 9733255, 2328309462), 1, 32);
      
      counter++;
      if(mesh_destruct.parts() != 8)stop = true;
   }  
    
   if(Kb.bp(KB_SPACE))
   {
      counter = 0;
      stop    = false;
   }
    
   if(Kb.bp(KB_ESC))return false;
  
   return true;    
}

void Draw()
{
   D.clear(TURQ);
  
   D.text (0,   0, S + counter + " : generated parts = " + mesh_destruct.parts() + " / 8");
  
   if(stop)D.text (0,   0.2, "Press SPACE to reset");
}
(This post was last modified: 09-13-2016 01:13 PM by Mardok.)
09-13-2016 02:56 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: [BUG] DestructMesh element out of range
Hi,

Maybe just the cuts don't guarantee creation of new parts, for example if for a random slicing plane all mesh is on one side, then there won't be any mesh slice operation.

I'm assuming that the out of range error happens in your own codes?
I think it's better approach to not assume you will get 8 parts.
09-13-2016 12:46 PM
Find all posts by this user Quote this message in a reply
Mardok Offline
Member

Post: #3
RE: [BUG] DestructMesh element out of range
(09-13-2016 12:46 PM)Esenthel Wrote:  Hi,

Maybe just the cuts don't guarantee creation of new parts...

Aaahhh oookkkk,

I thought the cuts limit always cut my mesh specified number of times. That explained all.

Sory for confusion.
09-13-2016 01:12 PM
Find all posts by this user Quote this message in a reply
Post Reply