StaticMesh help

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Spykam22
Posts: 13
Joined: Fri Dec 09, 2011 9:48 pm

StaticMesh help

Post by Spykam22 »

Hello! I've noticed that when my player is standing, above, or near a static mesh, it always thinks I'm intersecting it. For example, in the image below, I'm off the ground, but when I use ray casting, to pick another object like a box, it returns the static mesh and not the box. Any help? Thanks! :)
Image
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: StaticMesh help

Post by Norbo »

A few possibilities:
Some penetration is expected even in resting contact with other objects. The penetration can be up to CollisionDetectionSettings.AllowedPenetration. The default value is 0.01. This might be noticeable if your objects are exceptionally small (~0.02 units wide). In that case, the BEPUphysicsDemos ConfigurationHelper.ApplyScale would be useful.

If your objects have a normal size relative to the current tuning factors, make sure the ray origin and direction are valid. For example, if the ray origin starts below the character's feet or in a similarly odd location, it would tend to hit unexpected objects.

If you're using the Space.BroadPhase.QueryAccelerator.GetEntries(ray, ...) function, note that this returns objects with bounding boxes intersected by the ray. So, given that the player is standing inside a level, the character is contained in the level mesh's bounding box and so a ray cast will find the mesh object with T=0.
Post Reply