The capsule body is tightly attached to the wall
Closed this issue · 1 comments
Demo5 characters will stick to the wall when approaching it and will not move with the wall. This feature can be added
Here are the code changes
Demo05.cs line: 109
`if (kb.IsKeyDown(Keyboard.Key.Left))
player.SetAngularInput(-3.0f);
else if (kb.IsKeyDown(Keyboard.Key.Right))
player.SetAngularInput(3.0f);
else
player.SetAngularInput(0.0f);
if (kb.IsKeyDown(Keyboard.Key.Up))
player.SetLinearInput(-JVector.UnitZ * 15f);
else if (kb.IsKeyDown(Keyboard.Key.Down))
player.SetLinearInput(JVector.UnitZ * 15f);
else
player.SetLinearInput(JVector.Zero);`
Player.cs line: 217
`if (deltaMoveLen > 0.01f)
{
//if (bodyVelLen < 5f)
{
var force = JVector.Transform(deltaMove, Body.Orientation) * 1f;//10.0f;
//Body.AddForce(force);
force.Y = 0;
Body.Velocity = force;
// follow Newton's law (for once) and add a force
// with equal magnitude in the opposite direction.
floor!.AddForce(-force, Body.Position + hitpoint);
}
}`
The character controller in the demo is in no way perfect and just serves as a starting point.