SOLVED SnapCore and Intersect

Hi all,
I tried the code described in this thread: https://plugincafe.maxon.net/topic/6626/7199_r14-snap-system/10
This code inside the liquitool example work as expected.
But if i try to use SnapCore::Intersect instead SnapCore::Snap, to get the normal at point, this code don't work.

This is the line that I changed to:
if (snap->Intersect(pos, norm, false, res)) instead if (snap->Snap(pos, res))

Seem that the intersection don't work anymore.

Any help?
Thanks in advance
Renato T.

Real mx = msg.GetReal(BFM_INPUT_X);
Real my = msg.GetReal(BFM_INPUT_Y);
LONG button;
  
switch (msg.GetLong(BFM_INPUT_CHANNEL))
{
    case BFM_INPUT_MOUSELEFT : button=KEY_MLEFT; break;
    case BFM_INPUT_MOUSERIGHT: button=KEY_MRIGHT; break;
    default: return TRUE;
}
  
AutoAlloc<SnapCore> snap;  // Allocate snap
if (!snap) return FALSE;
  
snap->Init(doc, bd);
  
Real dx, dy;
BaseContainer bc;
BaseContainer device;
Vector pos;
SnapResult res;
  
BaseObject *active = doc->GetActiveObject();
  
win->MouseDragStart(button, mx, my, MOUSEDRAGFLAGS_DONTHIDEMOUSE|MOUSEDRAGFLAGS_NOMOVE);
while (win->MouseDrag(&dx,&dy,&device)==MOUSEDRAGRESULT_CONTINUE) // Start drag
{
    // Increment mouse position during drag
    mx += dx;
    my += dy;
    pos = bd->SW(Vector(mx, my, 500)); // Update pos
  
    if (snap->Snap(pos, res)) // If point snap anywhere 
    {
        pos += res.delta; // Pos will be updated with snapped delta
    }
  
    if (active)
        active->SetAbsPos(pos); // Set the object position to the new one!
  
    DrawViews(DRAWFLAGS_ONLY_ACTIVE_VIEW|DRAWFLAGS_NO_THREAD|DRAWFLAGS_NO_ANIMATION); // Update viewport
}
  
win->MouseDragEnd(); // Reset viewport status
  
EventAdd();

Seem that the normal is returned by SnapCore::Snap in SnapResult::mat.v2. I'm verifying

Hi @RenatoT, I don't think there is an issue,

just in case Intersect is supposed to work only for guide and spline see Modeling Settings - Intersection Snap. So maybe you are looking for GeRayCollider::Interesct.

Cheers,
Maxime.

Hi Maxime. Thanks for reply. At last I used the BVHTree for that.