just posting this on here because you guys have been so helpful in the past
what are some methods of finding the normal of a mesh at a given point. the point being the location of my ball/sphere that is rolling over a triangle mesh.
finding the closest point is the biggest issue because i dont know where to begin with this.
thanks
finding mesh normals *not bepu related
Re: finding mesh normals *not bepu related
To get the normals without using BEPUphysics, you'd have to write a fairly significant portion of the collision detection system. Fortunately, the CollisionPairs on the ball (assuming it is a BEPUphysics entity) have within them lists of contact points. Each contact has a normal, amongst other things.
The only trick would be to determine whether the other entity in the collision was part of a mesh. This could be done by specifying the StaticTriangleGroup's Tag to be itself so that all of its triangles will inherit that tag. If a CollisionPair contains an entity with the appropriate Tag, then you have a mesh collision.
Without using BEPUphysics, the problem gets harder due to the redundant work. You'd need an acceleration structure for your mesh to query to find the 'nearby' triangles. This could be an AABB tree like the engine uses, or anything else. Query that acceleration structure with the ball's shape to get the nearby triangles. Then, for each of those nearby triangles, compute contact data. Sphere-triangle can be boiled down to the closest point between a point and a triangle. If you only need a normal, that particular test could be optimized too.
The only trick would be to determine whether the other entity in the collision was part of a mesh. This could be done by specifying the StaticTriangleGroup's Tag to be itself so that all of its triangles will inherit that tag. If a CollisionPair contains an entity with the appropriate Tag, then you have a mesh collision.
Without using BEPUphysics, the problem gets harder due to the redundant work. You'd need an acceleration structure for your mesh to query to find the 'nearby' triangles. This could be an AABB tree like the engine uses, or anything else. Query that acceleration structure with the ball's shape to get the nearby triangles. Then, for each of those nearby triangles, compute contact data. Sphere-triangle can be boiled down to the closest point between a point and a triangle. If you only need a normal, that particular test could be optimized too.
Re: finding mesh normals *not bepu related
oh haha so i guess it is bepu related
so there will be several pairs and possibly several objects (depending on my scene and where the ball is) that i will have to chose from or average together to pick the one i need.
okay that makes sense ill start with that
here is my game so far
http://www.youtube.com/watch?v=bgmJS7AhyHA
so there will be several pairs and possibly several objects (depending on my scene and where the ball is) that i will have to chose from or average together to pick the one i need.
okay that makes sense ill start with that
here is my game so far
http://www.youtube.com/watch?v=bgmJS7AhyHA
Re: finding mesh normals *not bepu related
Yep, basically.so there will be several pairs and possibly several objects (depending on my scene and where the ball is) that i will have to chose from or average together to pick the one i need.
Looking goodhere is my game so far
