My issue is pretty unique, and I am not sure how to replicate it. I copied verbatim the code from the following demo files:
-CharacterController.cs
-CharacterNarrowphaseCallback.cs
-CharacterMotionConstraint.cs
-DemoPoseIntegrator.cs
-SimpleThreadDispatcher.cs
I am creating my character in the same order and with the same values as the demo:
Code: Select all
var shape = new Capsule(0.5f, 1);
((BEPUPhysics)player.Physics).ShapeIndex = CharacterControllers.Simulation.Shapes.Add(shape);
((BEPUPhysics)player.Physics).CharacterControllers = CharacterControllers;
int bodyHandle = ((BEPUPhysics)player.Physics).BodyHandle = CharacterControllers
.Simulation.Bodies.Add
(
BodyDescription.CreateDynamic
(
new Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z),
new BodyInertia { InverseMass = 1f / MASS },
new CollidableDescription(((BEPUPhysics)player.Physics).ShapeIndex, SPECULATIVE_MARGIN),
new BodyActivityDescription(shape.Radius * 0.02f)
)
);
ref var character = ref CharacterControllers.AllocateCharacter(bodyHandle);
character.LocalUp = new Vector3(0, 1, 0);
character.CosMaximumSlope = (float)Math.Cos(MAXIMUM_SLOPE);
character.JumpVelocity = JUMP_VELOCITY;
character.MaximumVerticalForce = MAXIMUM_VERTICAL_GLUE_FORCE;
character.MaximumHorizontalForce = MAXIMUM_HORIZONTAL_FORCE;
character.MinimumSupportDepth = shape.Radius * -0.01f;
character.MinimumSupportContinuationDepth = -SPECULATIVE_MARGIN;
Code: Select all
BufferPool = new BufferPool();
ThreadDispatcher = new SimpleThreadDispatcher(Environment.ProcessorCount);
CharacterControllers = new CharacterControllers(BufferPool);
Simulation = Simulation.Create(BufferPool, new CharacterNarrowphaseCallbacks(CharacterControllers), new PoseIntegratorCallbacks(new Vector3(0.0f, -10f, 0.0f)));
BUT where it get really weird is if I attach the visual studio debugger to my server process and put a breakpoint in the TryReportContacts method everything starts to work! My client can move, the breakpoint is being hit, everything seems to be running fine.
If I leave the server running, disconnect the client, remove the breakpoint, and login with the client again...nothing. No movement.
I have no idea where to begin with this one. Please help!