func (c *cam) update(camera vu.Camera) { fraction := 0.25 pitch := camera.Pitch() if !lin.Aeq(pitch, c.pitch) { pitch = (c.pitch-pitch)*fraction + pitch camera.SetPitch(pitch) } yaw := camera.Yaw() if !lin.Aeq(yaw, c.yaw) { yaw = (c.yaw-yaw)*fraction + yaw camera.SetYaw(yaw) } }
// reset puts the target pitch and yaw back to zero. func (c *cam) reset(camera vu.Camera) { c.pitch, c.yaw = 0, 0 camera.SetPitch(0) camera.SetYaw(0) }