I don't know why my code doesn't work. I'm using a math library to do all calculations on the server.
Here is my code. The attachment contains the error.
- Code: Select all
using MathS = MathNet.Spatial.Euclidean;
public class Player : BasePlayer {
(...)
public MathS.Quaternion rotation;
public MathS.Vector3D position;
public MathS.Vector2D curVelocity;
public float maxVelocity;
public Player()
{
(...)
rotation = QuaternionExt.identity();
position = new MathS.Vector3D(0, 0, 0);
curVelocity = new MathS.Vector2D(0, 0);
maxVelocity = 15f;
}
}
public override void GotMessage(Player player, Message message) {
switch (message.Type) {
case "Move":
(...)
if (player.curVelocity.Length > player.maxVelocity)
{
(...)
}