You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that I have the canvas dimensions smaller than the world dimensions. This is because the canvas dimensions represents the viewport, and the world dimensions represent the actual game dimensions.
I'm running into an issue when I want to set the viewport though. It seems to be scaling it wrong.
I'm not sure how LookAt works, but its showing me a much smaller part of the game stretched into the canvas. I am trying to for example show the viewport at x=50, y=0, width=600, height=600. This is basically the viewport moved to the right most.
The goal is for game room to be large rectangle, and viewport to be smaller rectangle. image
Does anyone know how to fix it?
Thanks
The text was updated successfully, but these errors were encountered:
Additional info:
I dont use the matter render loop. So i do rendering with 'Render.world' manually.
So propably you don't need my second line of code.
I just use the matter renderer to have an physics overlay over my game world, rendered with a render framework, so my variables for x and y define the upper left corner world view of the render ramework.
I think you could solve the adjustment stuff really easy.
I am making a RTS game in matter.js, similar to starcraft. One thing I want to implement is panning around with viewports.
I created the canvas and the world
Note that I have the canvas dimensions smaller than the world dimensions. This is because the canvas dimensions represents the viewport, and the world dimensions represent the actual game dimensions.
I'm running into an issue when I want to set the viewport though. It seems to be scaling it wrong.
I'm not sure how LookAt works, but its showing me a much smaller part of the game stretched into the canvas. I am trying to for example show the viewport at
x=50, y=0, width=600, height=600
. This is basically the viewport moved to the right most.The goal is for game room to be large rectangle, and viewport to be smaller rectangle.
image
Does anyone know how to fix it?
Thanks
The text was updated successfully, but these errors were encountered: