0

I have a mobile game in which there are invisible walls with a collider at the edge of the screens such that the game objects inside it can only be in the screen area and not outside of it. However, when I see my reviews it seems that the objects inside sometimes go outside of these walls because when you tap they may suddenly start moving fast and thus they may one frame be inside the walls and the next frame outside of them. (Mostly on slower devices)

The question is now: how should I handle this problem. Should I maybe make the movement slower or implement a function that checks whether it is still in the walls (seems not so elegant) or something else?

Wouter Vandenputte
  • 1,948
  • 4
  • 26
  • 50

2 Answers2

3

On your moving objects Rigidbody component, change the Collision Detection type from 'Discrete' to 'Continuous Dynamic'.

turnipinrut
  • 614
  • 4
  • 12
0

PS: I can't comment yet so I'll put mine here.

  • You can always have a dual barrier ( not an elegant solution but will work ).
  • Optimize more your game so that even at the lowest specification your game is playable and not only that, this might help your collider detects faster if the game is not laggy right?
  • If it hits the wall you can set a restart point maybe?

Just a suggestion that might help I guess. Good day mate :)