- Home /
Scaling a force according to objects' size
Hello, I can't seem to find a solution for my problem anywhere, so here it is: I'm working on an online turn-based 2D game for mobile where 2 players "shoot" pawns placed on a board to eject those of their opponent out of this board.
The issue is caused by the scaling of the objects: the board usually takes the whole device's width and is squared and the pawns are scaled following the same ratio. But since the board is actually bigger when the screen resolution is higher, the force should be "scaled" to match this difference so that any player plays the same game.
I couldn't find a good workaround or a mathematical expression (like a formula to calculate the force needed to go to a given distance) that would allow me to fix this. The pawns are only slowed by a linear drag (and their mass), there is no gravity.
I'm ready to provide any information needed. Thank you!
I am uncertain of what you are trying to do. Its not clear to me.
Let's say the board is a grid and one player pushes an object. It moves a certain distance due to the force applied, 2 squares for example. But for the other player, the grid's size is different due to scaling and with that same force, the object only moves 1 square away, because squares are bigger. I'm looking for a way to adjust this force so that it would actually move 2 squares away too.
Is the scale universal for each player. Like if p1 board is scale 1 then the cube will be scale 1 as well. And if p2's board is scale 1.75 then p2's board will be 1.75 as well?
Answer by dardamavet · Jul 11, 2017 at 02:25 PM
I would suggest not scaling the world objects themselves, but adjusting the aspect-ratio of the camera.
Perhaps this can be helpful: http://gamedesigntheory.blogspot.co.il/2010/09/controlling-aspect-ratio-in-unity.html