public class GravController implements ShipForcesInducer {
private final ServerShip ship;
public boolean shipChecker(List<AABB> aabbs, Vector3d point) {
boolean isInsideAnyAABB = false;
if(aabbs != null) {
for (AABB aabb : aabbs) {
if (
point.x >= aabb.minX && point.x <= aabb.maxX &&
point.y >= aabb.minY && point.y <= aabb.maxY &&
point.z >= aabb.minZ && point.z <= aabb.maxZ) {
isInsideAnyAABB = true;
} else {
isInsideAnyAABB = false;
}
}
}
return isInsideAnyAABB;
}
@Override
public void applyForces(@NotNull PhysShip physShip) {
double mass;
Vector3d forces;
GravitationalRiteType gravRite = new GravitationalRiteType();
if (shipChecker(gravRite.getAuras(),new Vector3d(physShip.getTransform().getPositionInWorld()))) {
mass = ship.getInertiaData().getMass();
forces = new Vector3d(0,mass*10,0);
physShip.applyInvariantForce(forces);
}
}
public GravController(ServerShip ship) {
this.ship = ship;
}
}```
Reply chain from #37
Iโve meant changing gravity vector, not โfakingโ it. But this will work, yes
thats a bad idea, youd make gravity non existant everywhere, which would cause issues in other places
1 reply not shown ยท View on Discord