Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How to find if a point is inside a mesh?

Years of Service
User Offline
Joined: 27th Oct 2013
Posted: 30th Jul 2018 00:44
I need code to find that vertex(point) is inside mesh.
I try to use Sparky's raycasting for this .Just check a few vectors from the point - if all of them collide that means that point is inside mesh.
But it doesn't work with backfaces - so If point is inside of a cube,for example, sparky will show that it is not.
So, any advice?
Years of Service
User Offline
Joined: 21st Oct 2015
Location: Lisbon
Posted: 30th Jul 2018 21:50
Probably you can do the opposite, check with vectors from outside to the point.
Years of Service
User Offline
Joined: 28th Nov 2014
Location: Russia
Posted: 31st Jul 2018 18:27 Edited at: 31st Jul 2018 18:29
It can be helped by stretching an object, if you stretch an object with a negative value like -100, then all the normals will turn out and you can start the raycast from the inside, but for this you need to correctly configure the object in sparky, in particular, sc_allowObjectScaling , or make another sparky object with reverse normals.
p.s. sorry for my poor English.

Login to post a reply

Server time is: 2019-08-24 10:54:08
Your offset time is: 2019-08-24 10:54:08