Skip to content

Commit a7bab22

Browse files
feat: clamp pitch within vanilla pitches
1 parent 60f0d49 commit a7bab22

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/plugins/physics.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,12 @@ function inject (bot, { physicsEnabled, maxCatchupTicks }) {
186186

187187
const maxDeltaYaw = PHYSICS_TIMESTEP * physics.yawSpeed
188188
const maxDeltaPitch = PHYSICS_TIMESTEP * physics.pitchSpeed
189+
189190
lastSentYaw += dYaw
190191
lastSentPitch += dPitch
191192

193+
lastSentPitch = math.clamp(-PI/2, lastSentPitch, PI/2)
194+
192195
const yaw = Math.fround(conv.toNotchianYaw(lastSentYaw))
193196
const pitch = Math.fround(conv.toNotchianPitch(lastSentPitch))
194197
const position = bot.entity.position

0 commit comments

Comments
 (0)