clientless movement packet
hey everyone, i'm having trouble figuring out how the movement packets work, this is the code i currently have, it disconnects me after 3 or so packets so something is surely wrong, but i can't figure out what, can anybody help me?
Code:
@hookPacket(PacketType.NEWTICK)
onNewTickPacket(client: Client, newTick: NewTickPacket): void {
let pos = client.worldPos;
//pos.x = pos.x + 0.001;
//pos.y = pos.y + 0.001;
const movePacket = new MovePacket();
movePacket.tickId = newTick.tickId;
movePacket.time = client.getTime();
movePacket.newPosition = pos;
//movePacket.records = [];
client.packetio.sendPacket(movePacket);
Log("test", client.worldPos.x + " " + client.worldPos.y);
}
- - - Updated - - -
nevermind i figured it out, there's a function called "client.nextPos" which handles movement for you