mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
entity: calculate eye position once per frame
This commit is contained in:
parent
304df9d189
commit
74191aa799
@ -134,12 +134,13 @@ abstract class Entity(
|
||||
}
|
||||
open val positionInfo = EntityPositionInfo(connection, this)
|
||||
|
||||
val eyePosition: Vec3
|
||||
get() = cameraPosition + Vec3(0.0f, eyeHeight, 0.0f)
|
||||
|
||||
var cameraPosition: Vec3 = position.toVec3
|
||||
private set
|
||||
|
||||
var eyePosition: Vec3 = cameraPosition
|
||||
private set
|
||||
|
||||
open val spawnSprintingParticles: Boolean
|
||||
get() = isSprinting && !isSneaking // ToDo: Touching fluids
|
||||
|
||||
@ -315,6 +316,7 @@ abstract class Entity(
|
||||
|
||||
open fun draw(time: Long) {
|
||||
cameraPosition = interpolateLinear((time - lastTickTime) / ProtocolDefinition.TICK_TIMEf, Vec3(previousPosition), Vec3(position))
|
||||
eyePosition = cameraPosition + Vec3(0.0f, eyeHeight, 0.0f)
|
||||
cameraAABB = defaultAABB + cameraPosition
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user