Skip to content

Commit 3593075

Browse files
committed
Fix Freecam lerp issue (kamigen caused it haha)
1 parent 8cf31ae commit 3593075

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

common/src/main/kotlin/com/lambda/module/modules/player/Freecam.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object Freecam : Module(
4646
private var lastPerspective = Perspective.FIRST_PERSON
4747
private var prevPosition: Vec3d = Vec3d.ZERO
4848
private var position: Vec3d = Vec3d.ZERO
49-
private val interpolatedPosition: Vec3d
49+
private val lerpPos: Vec3d
5050
get() = prevPosition.interpolate(position, mc.partialTicks)
5151

5252
private var rotation: Rotation = Rotation.ZERO
@@ -56,7 +56,7 @@ object Freecam : Module(
5656
fun updateCam() {
5757
mc.gameRenderer.apply {
5858
camera.setRotation(rotation.yawF, rotation.pitchF)
59-
camera.setPos(interpolatedPosition.x, interpolatedPosition.y, interpolatedPosition.z)
59+
camera.setPos(lerpPos.x, lerpPos.y, lerpPos.z)
6060
}
6161
}
6262

@@ -122,7 +122,7 @@ object Freecam : Module(
122122
it.cancel()
123123

124124
mc.crosshairTarget = rotation
125-
.rayCast(reach, interpolatedPosition)
125+
.rayCast(reach, lerpPos)
126126
.orMiss // Can't be null (otherwise mc will spam "Null returned as 'hitResult', this shouldn't happen!")
127127
}
128128

common/src/main/kotlin/com/lambda/util/math/Linear.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ fun lerp(value: Double, start: Vec2d, end: Vec2d) =
113113
*/
114114
fun lerp(value: Double, start: Vec3d, end: Vec3d) =
115115
Vec3d(
116-
lerp(start.x, end.x, value),
117-
lerp(start.y, end.y, value),
118-
lerp(start.z, end.z, value),
116+
lerp(value, start.x, end.x),
117+
lerp(value, start.y, end.y),
118+
lerp(value, start.z, end.z),
119119
)
120120

121121
/**

0 commit comments

Comments
 (0)