   Is the Player inside the Levelmesh
  Hello EverybodyIm experimenting with a small 3D Environment. Right now I load my Level Mesh, render it and walk around.My Problem is, that my method of collision detection is a bit messy. Let me explain:1) I cast a ray from Camera.Position down until i hit a triangle from the mesh.then i know that i am above a ground tile, and retrieve my height.2) i cast a ray from Camera.Position in direction of Camera.LookAt and measure the distance. If it is smaller than 0.2 Units I am in front of a wall and have to stop moving.The Problem is, that the collision detection is sloppy and has many jumps in it. Is there a gentler way of determining if a point is inside an arbitrary mesh?Additionaly my method is not suited for real 3D Dungeons, as you can walk through walls if there is a tile on a level underneath|_____P|<-You can walk right through and land on the lower corridor....................|P__________ <- landing here and continuing movementwhere P is the Player| are walls_ is a floor tileSo if anybody knows a trick how i can solve this problem i would be very grateful.NukleonEDITIm using C# under #Developwith ManagedDirectXEDIT2A solution i have been thinking of, would be to fit a cylinder or sphere inside the mesh but then im still bumped at the collision detection. My level is of the Mesh Class and constructed from a .x file[Edited by - Nukleon on December 12, 2005 4:46:12 PM]
  No one knows a solution?If things are unclear please post them and I will try to make them more clear.>>I am looking for a way of determining if a Point is Inside a Mesh<<EDIT:a possible solution might be the recognition of a point passing through a vertex of the mesh and then reversing the move action that led to the traversion. is that  possible at runtime?Nukleon[Edited by - Nukleon on December 13, 2005 10:37:41 AM];  You should probably try using triangle-sphere or triangle-ellipsoid test instead of ray. Try this: Improved Collision Detection and Response A great article which also covers a bit of implementation specifics.Hope this helpsRegards,/Omid   ;  Good Evening!I managed to determine if i am inside the mesh by counting the number of hits, my forward ray does when being cast. if it is even then i am outside otherwise im inside. I had to adjust my level a bit though.The problem now is, that when i know that i left the level i do not know how to get back. simply checking after each movement and subtracting the velocity gets me stuck. Ho do i move the point just a litte more back, so that it will always end up inside the mesh (a multiplication won't do it, sometimes i still land outside the mesh)Nukleon   ;  Hi Nukleon, collision detection can be quite a big subject, you can check out a tutorial here; http://www.peroxide.dk/  -there is a tutorial probably under the "tuts" tab thingy at the top.There maybe some easier ways of doing it, but I would also suggest, you learn abit about meshes etc, (if you haven't already), such as did you know you can "get" a face (triangle), of a mesh by accessing the meshes vertex buffer and finding the vertice + offset (or something like that). All I'm saying is the more you know about the subject the better, because then you will know waht you are dealing with.Also yes I think you can reverse your move action, I'm not sure you'd want to reverse back up from being on the floor below.. you really need to detect things before you get to that.If you want to learn more about meshes etc look them up in the docs, really they are exactly the same as triangles you might make your self, - except they are all kept together in a mesh object, you can access the vertices, change the vertes buffer layout, anyhtinng you want, I did that just with the D3DXCreateBox function and learnt quite a lot from it.Anyway., sorry, hope someone can help you more with the collision thing.Steve;  hey thanks, the article at peroxide.dk is really good.but i don't really understand it yet, and transforming it to my situation is a bit difficult.but i think im on the right track. i think what i need are sliding planes. they will hopefully give me the required behaviour.thank you very much for your postsNukleon   