Trying to add slight camera smoothing mainly as a test, but these setYaw and setPitch methods seem to not work at all. I'm dying tring to figure out why. There are no errors.
let prevYaw
let prevPitch
onEvent('player.tick', event => {
if (prevYaw == null) {
prevYaw = event.player.yaw
}
if (prevPitch == null) {
prevPitch = event.player.pitch
}
let yaw = event.player.yaw
let pitch = event.player.pitch
let yawDiff = yaw - prevYaw
let pitchDiff = pitch - prevPitch
if (yawDiff > 180) {
yawDiff = yawDiff - 360
}
if (yawDiff < -180) {
yawDiff = yawDiff + 360
}
if (pitchDiff > 180) {
pitchDiff = pitchDiff - 360
}
if (pitchDiff < -180) {
pitchDiff = pitchDiff + 360
}
let newYaw = prevYaw + yawDiff / 1.005
let newPitch = prevPitch + pitchDiff / 1.005
event.player.tell(`Yaw: ${newYaw}, Pitch: ${newPitch}`)
event.player.setYaw(newYaw)
event.player.setPitch(newPitch)
event.player.tell(`Yaw: ${event.player.yaw}, Pitch: ${event.player.pitch}`)
prevYaw = newYaw
prevPitch = newPitch
})

