c# - Matrix.CreateScale only scaling with full numbers -
i've been trying zoom in , out on objects using matrix.createscale() function, using this:
matrix.createscale(new vector3(zoom, zoom, 0))
but, i've noticed when tried make zoom 1,5 doesn't anything, @ numbers 1 or 2, when reaches it's big/small, how zoom in , out without taking such big steps, how make take less steps?
public float zoom { { return zoom; } set { zoom = value; } } public matrix get_transformation(graphicsdevicemanager graphicsdevice) { transform = matrix.createtranslation(new vector3(-pos.x, -pos.y, 0)) * matrix.createrotationz(rotation) * matrix.createscale(new vector3(zoom, zoom, 0)) * matrix.createtranslation(new vector3(graphicsdevice.graphicsdevice.viewport.width * 0.0f, graphicsdevice.graphicsdevice.viewport.height * 0.0f, 0)); return transform; } //zooming float scrollvalue = mouse.getstate().scrollwheelvalue / 480; core.cam.zoom = scrollvalue;
basically, each time scroll increase zoom value 0.25, , should something, after 4 scrolls (4*0.25 = 1)
edit:
fixed changing
float scrollvalue = mouse.getstate().scrollwheelvalue / 480;
to
float scrollvalue = mouse.getstate().scrollwheelvalue / 480f;
Comments
Post a Comment