This commit is contained in:
Andrew Lalis 2022-07-21 13:13:52 +02:00
parent b1d3abc8c8
commit 4ef355f707
2 changed files with 9 additions and 2 deletions

View File

@ -13,7 +13,7 @@ public class ClientConfig {
public static class DisplayConfig {
public boolean fullscreen = false;
public boolean captureCursor = false;
public boolean captureCursor = true;
public float fov = 70;
}
}

View File

@ -3,6 +3,8 @@ package nl.andrewl.aos2_server;
import nl.andrewl.aos2_server.model.ServerPlayer;
import nl.andrewl.aos2_server.model.ServerProjectile;
import nl.andrewl.aos_core.model.Projectile;
import nl.andrewl.aos_core.model.world.Hit;
import nl.andrewl.aos_core.net.world.ChunkUpdateMessage;
import org.joml.Vector3f;
import java.util.HashMap;
@ -46,9 +48,14 @@ public class ProjectileManager {
projectile.getVelocity().y -= server.getConfig().physics.gravity * dt;
// TODO: Check if bullet will hit anything, like blocks or players, if it follows current velocity.
Vector3f movement = new Vector3f(projectile.getVelocity()).mul(dt);
Vector3f movementDir = new Vector3f(movement).normalize();
// Hit hit = server.getWorld().getLookingAtPos(projectile.getPosition(), movementDir, movement.length());
projectile.getPosition().add(movement);
if (projectile.getDistanceTravelled() > 500) {
// if (hit != null) {
// server.getWorld().setBlockAt(hit.pos().x, hit.pos().y, hit.pos().z, (byte) 0);
// server.getPlayerManager().broadcastUdpMessage(ChunkUpdateMessage.fromWorld(hit.pos(), server.getWorld()));
// }
removalQueue.add(projectile);
server.getPlayerManager().broadcastUdpMessage(projectile.toMessage(true));
} else {