Differences Between Version 1.14 to 1.15

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
lareusoular
Posts: 40
Joined: Mon Sep 06, 2010 9:22 pm

Differences Between Version 1.14 to 1.15

Post by lareusoular »

Ok, If you could help me, I'm having some issues updating my game to 1.15... I have analyzed the DEMO, but somethings are not clear:
1. First of all, I used this, then I corrected, see if is it perfect:
foreach (CollidablePairHandler Col in BepuEntity.Entity.CollisionInformation.Pairs)
{
foreach (ContactInformation contact in Col.Contacts)
{
if ((float)Math.Acos(Math.Abs(contact.Contact.Normal.X)) < MathHelper.PiOver4 ||
(float)Math.Acos(Math.Abs(contact.Contact.Normal.Z)) < MathHelper.PiOver4)
{

The idea of this method is to see if there's a wall in my front
BUTTT, I used this:
Entity entity;

if (contact.Contact.ColliderA == BepuEntity.Entity)
entity = contact.ColliderB;
else
entity = contact.ColliderA;
if (entity is Box)
{
Box box = entity as Box;
if (box.Height > 1.5f)
return CoverType.Left;
else
return CoverType.Down;
}

To see what type of Cover my player should do, but now I can't... Is there any way to detect that?

2. Where is the Space.BroadPhase.GetEntities(BehindSphere, gotEntities);?

I'm going to post more, I have mmmmmannnny errors here. Thanks for the awesome engine =)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Differences Between Version 1.14 to 1.15

Post by Norbo »

First part looks good.

For the second part, you have a few options. One is to set the entity's collidable's tag to the entity itself. That way, without even knowing that the opposing object is an EntityCollidable, you could grab its entity. Note that the BroadPhaseEntry Tag property inherited by the Collidable is separate from the Entity.Tag.

You could also cast the other collidable in the pair to an EntityCollidable. If it is one, then you can check its entity directly.

Since you are looking for shape data, you could avoid the entity-checking entirely. Instead, you can check the Collidable's shape. If it's a BoxShape, you can access the height directly.

Contacts do not store colliders, but you can go by where you got the contacts from.
2. Where is the Space.BroadPhase.GetEntities(BehindSphere, gotEntities);?
The queries were moved into the QueryAccelerator property on the broadphase, so Space.BroadPhase.QueryAccelerator.GetEntries. Note that it no longer retrieves entities, but rather BroadPhaseEntries. This is because the broad phase contains more than just entities. If you need to get the entity or gameplay data from a broad phase entry, you can store it in the BroadPhaseEntry's Tag property or try to cast it to an EntityCollidable as described earlier.
Post Reply