Skip to content

Commit

Permalink
glitchy planes at yaw 90 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Goby56 committed Apr 3, 2024
1 parent 3d62c18 commit 2acaa16
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ private void aliveTick(ProducesWake wakeProducer) {
this.ticksSinceSplash++;

Vec3d vel = wakeProducer.getNumericalVelocity();
// TODO FIX GLITCHY PLANES AT YAW = 90
this.yaw = 90 - (float) (180 / Math.PI * Math.atan2(vel.z, vel.x));
this.yaw = 90f - (float) (180f / Math.PI * Math.atan2(vel.z, vel.x));
Vec3d normVel = vel.normalize();
Vec3d planePos = this.owner.getPos().add(normVel.multiply(this.owner.getWidth() + WakesClient.CONFIG_INSTANCE.splashPlaneOffset));
this.setPos(planePos.x, wakeProducer.producingHeight(), planePos.z);
Expand All @@ -92,9 +91,16 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti
MatrixStack modelMatrix = getMatrixStackFromCamera(camera, tickDelta);
int light = this.getBrightness(tickDelta);

float yawLerp = MathHelper.lerp(tickDelta, this.prevYaw, this.yaw);
float diff = this.yaw - this.prevYaw;
if (diff > 180f) {
diff -= 360;
} else if (diff < -180f) {
diff += 360;
}

float yawLerp = (this.prevYaw + diff * tickDelta) % 360f;

modelMatrix.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yawLerp + 180));
modelMatrix.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yawLerp + 180f));
SplashPlaneRenderer.render(this.owner, yawLerp, tickDelta, modelMatrix, light);
}

Expand Down

0 comments on commit 2acaa16

Please sign in to comment.