Need help with a snap

Hi,
I want to create a snap between the line that I create on mouse move and another line determined by two points. I was able to do this, but for some reason, it doesn’t work well when the angle between the movable line and the other line is different from 90 degrees. I’m not sure why.



Please advice
Thank you!

Can you please share a repro in the playground to have others help you ?

Ah sorry, I forgot

it is because you compute the distance based on the none rounded angle as we can see here: https://www.babylonjs-playground.com/#1U68CD#38

you should change the code to compute the distance factoring the change of angle in.

2 Likes

Thanks, I understood!
Now I have to combine them somehow :sweat_smile: because I still need that feature with a fixed angle snap and this snap to line together. I’ll trry and come back with updates :fire: