A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by akira2049 » Fri Dec 23, 2011 2:06 pm
Hi guys
First im a complete newb in math about raycast, 3D and stuff like that. I have a small program in c#, it's not a 3d engine or anything related to game but i need to calculate if a line made of 2 points (x,y,z) go through a static mesh and if yes set a thrid point between the two to do the optimal line to avoid that object. So a kind of function that look for line-of-sight between the 2 points and if it's not return the coord of the third point, simple as that and nothing more. i've looked on google but cant seem to find the best solution for that and like i said, im a newb forthat so finding an existing library or bit of code would be the best. If Newton is not really made for that and know a good solution let me know.
Regards
-
akira2049
-
by JoeJ » Fri Dec 23, 2011 3:34 pm
Yes, you can do that with newton. You can load the mesh as collision tree, and do the raycast as you want.
I'm not sure if it can handle double sided polys (polys that don't divide space in empty and solid space, like a piece of paper...), but i think this was added already.
Newton will partition the mesh in BVH tree, so raycasting is very fast. Check the provided demos and tutorials.
Alternatives would be to look at other physics libs, or do it yourself:
Google will help you to find ray / triangle intersection code easily.
If you can get that working, but it's too slow you need some space partitition tree. Loose octree is the most easy to implement.
It's interresting, but would cost you a lot of time

-

JoeJ
-
- Posts: 1489
- Joined: Tue Dec 21, 2010 6:18 pm
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest