mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
fix 3rd person not raycasting correctly when viewing player from front
This commit is contained in:
parent
4491522e6b
commit
50ca412424
@ -57,12 +57,12 @@ class ThirdPersonView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun update(position: Vec3d, front: Vec3) {
|
private fun update(position: Vec3d, front: Vec3) {
|
||||||
val target = camera.context.connection.camera.target.raycastBlock(position, -front.toVec3d).first
|
val front = if (inverse) -front else front
|
||||||
|
val target = camera.context.connection.camera.target.raycastBlock(position, front.toVec3d).first
|
||||||
val distance = target?.distance?.let { minOf(it, MAX_DISTANCE) } ?: MAX_DISTANCE
|
val distance = target?.distance?.let { minOf(it, MAX_DISTANCE) } ?: MAX_DISTANCE
|
||||||
|
|
||||||
val front = if (inverse) front else -front
|
this.eyePosition = if (distance <= 0.0) position else position + (front * (distance - MIN_MARGIN))
|
||||||
this.eyePosition = if (distance <= 0.0) position else position + (-front * (distance - MIN_MARGIN))
|
this.front = -front
|
||||||
this.front = front
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(previous: CameraView?) {
|
override fun onAttach(previous: CameraView?) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user