Physics functions with different resolutions!

HI! I have my scripts:

  1. Collider2D[ ] hitColliders = Physics2D.OverlapCircleAll(vector 2 pos, float radius);

I need to get all colliders from point(pos) with radius half of Screen.width with different screen resolution. How can I give these parameters (pos and radius) to this function?

  1. playerObject.GetComponent ().AddForce (new Vector2 (direction.x * powerMultipl,
    direction.y * powerMultipl), ForceMode2D.Impulse);

The same thing! I want to scale my force depending on screen resolution!

All I need is my game to be played in the same way on devices with different screen resolution! Thnx for helping me!

Did you solve it?

My question is the same as you, but now no thought

I use AddForce in 1920 x 1080 is very slow, but in 480 x 320 is very fast, What should I do?

First, gmfy, EDIT your posts instead of creating new ones within mere seconds-minutes of each other.

Second, please post a screenshot of your Profiler to depict the performance difference you’re seeing. If you’re not looking at the Physics profiler section and just at framerate, remember that resolution effects mainly render-time.

To the OP, Physics is virtual and shouldn’t be effected at all by resolution. Your physics should be effected by “world” not by “screen”. Even if I’m peering through a tiny window at your game world, your explosion should have the same effect.
That said, I would need an elaboration of your situation/issue to give a better answer. It seems you’re already aware of Screen.width, so I’m not sure why you’d have issues using it to calculate your radius.

1 Like

It happened to me and what you have to do is use Time.deltaTime. When reducing the resolution, the FPS increase so the code where you use (for example) an AddForce will be executed more times than in a lower FrameRate

1 Like