I am testing out BEPU or any physics engine for that matter, but I decided to try this one out first and I am running into an issue where I can collide with a handful of boxes and then the player controlled object will not collide with any other objects the rest of time. I currently have all the objects setup as boxes.
Code: Select all
Player.Boundary = new BEPUphysics.Entities.Prefabs.Box(new BEPUutilities.Vector3(10, 10, 0), 32, 32, 32, 2);
In addition I am building a 2d game using top down view and currently using the ApplyLinearImpulse to move the character which works fine for the most part but I am curious is there a way to prevent the characters from sliding all over the place? Thanks in advance for any help!
Code: Select all
public override void Move(DirectionHeading direction, bool sprint)
{
Direction = direction;
float adjustedVelocity = Properties.ValueOf(Database.Common.Velocity);
if (sprint == true)
{
adjustedVelocity *= 2.0f;
}
Vector3 pulse = new Vector3(0, 0, 0);
switch (direction)
{
case DirectionHeading.East:
pulse.X = adjustedVelocity;
break;
case DirectionHeading.West:
pulse.X = -adjustedVelocity;
break;
case DirectionHeading.North:
pulse.Y = -adjustedVelocity;
break;
case DirectionHeading.South:
pulse.Y = adjustedVelocity;
break;
}
Boundary.ApplyLinearImpulse(ref pulse);
}