diff --git a/src/main/java/org/valkyrienskies/mod/common/collision/WorldWaterCollider.java b/src/main/java/org/valkyrienskies/mod/common/collision/WorldWaterCollider.java index be43db950..8e8ba58ed 100644 --- a/src/main/java/org/valkyrienskies/mod/common/collision/WorldWaterCollider.java +++ b/src/main/java/org/valkyrienskies/mod/common/collision/WorldWaterCollider.java @@ -100,7 +100,7 @@ public void addBuoyancyForces() { final int hash = cachedPotentialHits.get(i); SpatialDetector.setPosWithRespectTo(hash, centerPotentialHit, currentPos); - final Vector3dc waterPosInShipSpace = physicsTransform.transformPosition(JOML.convertDouble(currentPos, temp0).add(.5, .5, .5), TransformType.GLOBAL_TO_SUBSPACE); + final Vector3dc waterPosInShipSpace = physicsTransform.transformPositionNew(JOML.convertDouble(currentPos, temp0).add(.5, .5, .5), TransformType.GLOBAL_TO_SUBSPACE); final int minX = (int) Math.floor(waterPosInShipSpace.x() - .5); final int minY = (int) Math.floor(waterPosInShipSpace.y() - .5); @@ -124,7 +124,7 @@ public void addBuoyancyForces() { if (terrainOctree.get(x & 15, y & 15, z & 15)) { // Assume both the water block and terrain block are spheres, then compute the volume // that overlaps - final Vector3dc shipSolidBlockPosInWorld = physicsTransform.transformPosition(temp2.set(x + .5, y + .5, z + .5), TransformType.SUBSPACE_TO_GLOBAL); + final Vector3dc shipSolidBlockPosInWorld = physicsTransform.transformPositionNew(temp2.set(x + .5, y + .5, z + .5), TransformType.SUBSPACE_TO_GLOBAL); final double volumeDisplaced = calculateAABBOverlap( waterPosInWorld.x() - shipSolidBlockPosInWorld.x(), diff --git a/src/main/java/org/valkyrienskies/mod/common/ships/ship_transform/ShipTransform.java b/src/main/java/org/valkyrienskies/mod/common/ships/ship_transform/ShipTransform.java index ca460f5ab..65962c84c 100644 --- a/src/main/java/org/valkyrienskies/mod/common/ships/ship_transform/ShipTransform.java +++ b/src/main/java/org/valkyrienskies/mod/common/ships/ship_transform/ShipTransform.java @@ -88,14 +88,28 @@ public static Matrix4d createTransform(ShipTransform prev, ShipTransform current return current.subspaceToGlobal.mul(prev.globalToSubspace, new Matrix4d()); } - public Vector3d transformPosition(Vector3d position, TransformType transformType) { + /** + * Better than {@link #transformPosition(Vector3d, TransformType)} + */ + public Vector3d transformPositionNew(Vector3d position, TransformType transformType) { return getTransformMatrix(transformType).transformPosition(position); } - public Vector3d transformDirection(Vector3d direction, TransformType transformType) { + /** + * Better than {@link #transformDirection(Vector3d, TransformType)} + */ + public Vector3d transformDirectionNew(Vector3d direction, TransformType transformType) { return getTransformMatrix(transformType).transformDirection(direction); } + public void transformPosition(Vector3d position, TransformType transformType) { + getTransformMatrix(transformType).transformPosition(position); + } + + public void transformDirection(Vector3d direction, TransformType transformType) { + getTransformMatrix(transformType).transformDirection(direction); + } + public Vec3d transform(Vec3d vec3d, TransformType transformType) { Vector3d vec3dAsVector = JOML.convert(vec3d); transformPosition(vec3dAsVector, transformType);