A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by mikeman42 » Sun Aug 09, 2009 8:22 am
Quick question...is there any way to find out if a specified 3D point is 'inside' or 'outside' a collision mesh?
Only way I have figured out until now is cast a large ray from that point to a direction, determine the first hit, and then cast a ray from the first hit to that point again. I figure it it's inside a mesh then it will register a hit, otherwise not. But I'm not very happy with this solution, is there any more straightforward way to do this? Thank you.
-
mikeman42
-
- Posts: 19
- Joined: Tue May 01, 2007 6:08 pm
by Julio Jerez » Sun Aug 09, 2009 9:26 am
if you are refering to a collision shape in newton, you can call funtion NewtonClosesttPoint
It will returns teh closest distance form teh point to the shape. if the point is inside or in the surface of the shape the distance is zero.
It only works on convex and compound shapes.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by mikeman42 » Sun Aug 09, 2009 4:38 pm
Hm...in my case I want to test the world geometry, which will probably be not convex....so there is no other solution?
-
mikeman42
-
- Posts: 19
- Joined: Tue May 01, 2007 6:08 pm
by JernejL » Sun Aug 09, 2009 5:44 pm
if it's a concave compound made of convex parts then it's ok, if it's a trimesh you'll need to use something else to perform the testing, doing this on trimesh is no easy task.
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Julio Jerez » Sun Aug 09, 2009 9:17 pm
so far I know a level mesh is an open surface, tha mean the is no comcept of in ot out.
The only way I can thonk of is bu using ray cast.
what is this for? Maybe there are diffrent ways to do what you want
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 42 guests