Calc the zoom location of where the mouse currently is in the worldĬamera.unproject(tp.set((), (), 0 )) change is 1 or -1.įloat zoomChange = change * camera.zoom * 0.3f Scrolled Call: //Calc the zoom on the mouse wheel. Since the camera has not actually moved to the current mouse pointer in my implementation (there's some sort of strange jitter* that seems to happen frequently time I use the mousewheel), it uses the mouse again to calculate the new position. The main issue is if I keep scrolling the mouse wheel while update is interpolating to these points. These get interpolated during the update call.įloat lerpedZoom = camera.zoom + (moveToZoom - camera.zoom) * 0.03f įloat x = + (moveToPosition.x - ) * lerpMove įloat y = + (moveToPosition.y - ) * lerpMove (x,y, 0) I have a float moveToZoom and Vector2 moveToPosition that contain the values I want to move to. ![]() I can get this working for the origin but when I try to use the mouse coordinates, things get more difficult and I experience undefined behavior. HI, I'm trying to implement mouse wheel zoom to mouse using interpolation so the movement does not appear choppy.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |