Skip to content

Commit

Permalink
rm
Browse files Browse the repository at this point in the history
  • Loading branch information
xiewuzhiying committed Jul 30, 2024
1 parent 4f03e24 commit 468ace7
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.spaceeye.someperipherals.stuff.raycasting

import org.joml.Quaternionf
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.server.level.ServerLevel
Expand All @@ -16,7 +17,6 @@ import net.spaceeye.someperipherals.SomePeripherals
import net.spaceeye.someperipherals.SomePeripheralsConfig
import net.spaceeye.someperipherals.stuff.BallisticFunctions.rad
import net.spaceeye.someperipherals.stuff.utils.*
import org.joml.Quaternionf
import org.valkyrienskies.mod.common.getShipManagingPos
import java.lang.Math.*

Expand Down Expand Up @@ -243,7 +243,7 @@ object RaycastFunctions {
//No idea how or why it works, don't use it anywhere else other than eulerRotationCalc
private fun quatToUnit(rot: Quaternionf): Vector3d {
val quint = Quaternionf(0f, 1f, 0f, 0f)
val rota = Quaternionf(-rot.x(), -rot.y(), -rot.z(), rot.w())
val rota = Quaternionf(rot).conjugate()
rot.mul(quint); rot.mul(rota)
return Vector3d(
-rot.x().toDouble(),
Expand All @@ -258,7 +258,7 @@ object RaycastFunctions {
val yaw = (if (yaw_ < 0) { max(yaw_, -PI/2) } else { min(yaw_ , PI/2) })

//idk why roll is yaw, and it needs to be inverted so that +yaw is right and -yaw is left
val rotation = Quaternionf().rotateXYZ(-yaw.toFloat(), pitch.toFloat(), 0f)
val rotation = Quaternionf().rotationXYZ(-yaw.toFloat(), pitch.toFloat(), 0f)
direction.mul(rotation)
return quatToUnit(direction)
}
Expand Down Expand Up @@ -346,8 +346,8 @@ object RaycastFunctions {
Direction.EAST -> Vector3d(0, 1, 0)
null -> throw AssertionError("Direction is null, how.")
}
val vec = dir_enum.step().normalize()
val dir = Vector3d(vec.x(), vec.y(), vec.z())
val tmp = dir_enum.step()
val dir = Vector3d(tmp.x, tmp.y, tmp.z).snormalize()
vectorRotationCalc(Pair(dir, dir.cross(up).scross(dir)), var1, var2, var3)
}

Expand Down

0 comments on commit 468ace7

Please sign in to comment.