MobilMesh raycast problem

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
emmo30
Posts: 9
Joined: Sat Dec 10, 2011 3:51 pm

MobilMesh raycast problem

Post by emmo30 »

Hi, When i import a personnalized mesh
Image

with this method:

Code: Select all

            personnage = new MobileMesh(vertices, indices, AffineTransform.Identity, MobileMeshSolidity.Clockwise);
            personnage.LocalInertiaTensorInverse = new BEPUphysics.MathExtensions.Matrix3X3();
            personnage.Position = position;
            personnage.OrientationMatrix = Matrix3X3.CreateFromMatrix(Model.Bones[0].Transform);
            space.Add(personnage);
i can't do a collision all of my mesh
Look at:
Image

if u see Y axe we can see a collision but

Image
can u say me why?
is probleme of my mesh?
thank, Emre
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: MobilMesh raycast problem

Post by Norbo »

Have you tried using Counterclockwise winding instead of Clockwise winding in the constructor? That might cause it- essentially, the model would be inside-out.

[EDIT: For others who might read this in the future, the above isn't really a good explanation for the raycast behavior. Even if it were inside out, any ray cast impact points can only be on the mesh itself. The graphics mismatch suggested in a later post is the most likely explanation for this sort of issue.]

By the way, generally it's a good idea to avoid using MobileMeshes unless you absolutely have to. They're not bad, but approximations with primitives (like sphere, box, etc.) or compound bodies made of multiple primitives are much faster and generally more robust.
emmo30
Posts: 9
Joined: Sat Dec 10, 2011 3:51 pm

Re: MobilMesh raycast problem

Post by emmo30 »

I have same result with all MobilMeshSolidity, I will try with a box to see if the result is more conclusive.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: MobilMesh raycast problem

Post by Norbo »

Another thing to look out for is the graphics not being in the same spot as the physics. Using the BEPUphysicsDrawer from the BEPUphysicsDemos in the main source download is a good way of visualizing the collision shapes.
emmo30
Posts: 9
Joined: Sat Dec 10, 2011 3:51 pm

Re: MobilMesh raycast problem

Post by emmo30 »

It work perfectly Thanks.
Post Reply