How to add force based on surrounding colliders in 2D?
Hi there, I am new to programming and forums, if there is a way I can update this to make it easier to read or anything like that please let me know.
I have an object in Unity 2D that is surrounded by 4 box colliders. Each update these colliders check to see if they are making contact with the level. If you press a key the program detects which of these colliders is making contact with the level, and then adds force in a direction based on that. e.g, if there is a block below and to the left of the object, it is launched upwards and to the right. The function to complete this is activated by pressing a button, which is checked in update().
This works, but it is very inconsistent. Sometimes it works perfectly and other times the object may jitter or not move at all. Could anybody recommend a way to get more consistent results or spot anything I may be doing wrong? Thank you for your help.