Saving face

- Remove rotateToFace "optimization" that ended up generating NaNs in
  TransformedInstance
- Switch a rotateTo to a rotationTo to save some fmas
This commit is contained in:
Jozufozu 2025-02-08 14:11:33 -08:00
parent 77cd4fb898
commit 22c482283f
2 changed files with 1 additions and 10 deletions

View file

@ -10,7 +10,6 @@ import com.mojang.blaze3d.vertex.PoseStack;
import dev.engine_room.flywheel.api.instance.InstanceHandle;
import dev.engine_room.flywheel.api.instance.InstanceType;
import dev.engine_room.flywheel.lib.transform.Affine;
import net.minecraft.core.Direction;
public class TransformedInstance extends ColoredLitOverlayInstance implements Affine<TransformedInstance> {
public final Matrix4f pose = new Matrix4f();
@ -148,12 +147,4 @@ public class TransformedInstance extends ColoredLitOverlayInstance implements Af
pose.rotateZ(radians);
return this;
}
@Override
public TransformedInstance rotateToFace(Direction facing) {
// Need to invert the step because the super default method rotates from North (-Z),
// but rotateTowards rotates from South (+Z)
pose.rotateTowards(-facing.getStepX(), -facing.getStepY(), -facing.getStepZ(), 0, 1, 0);
return this;
}
}

View file

@ -100,7 +100,7 @@ public interface Rotate<Self extends Rotate<Self>> {
}
default Self rotateTo(float fromX, float fromY, float fromZ, float toX, float toY, float toZ) {
return rotate(new Quaternionf().rotateTo(fromX, fromY, fromZ, toX, toY, toZ));
return rotate(new Quaternionf().rotationTo(fromX, fromY, fromZ, toX, toY, toZ));
}
default Self rotateTo(Vector3fc from, Vector3fc to) {