StaticMesh help

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

StaticMesh help

Post by Spykam22 » Sun Sep 08, 2013 5:43 pm

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! :)

Site Admin
Posts: 4707
Joined: Tue Jul 04, 2006 4:45 am

Re: StaticMesh help

Post by Norbo » Sun Sep 08, 2013 6:02 pm

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

Who is online

Users browsing this forum: No registered users and 9 guests