Hello,
Sorry if this question has already been answered, I've looked around without finding anything helpful. But I'm not sure I'm using the correct vocabulary..
I'm using the awesome MoveTo behavior made by rexrainbow to control my character from a top point of view.
I'm clicking/touching the screen to make my character move in a direction (using the Touchwrap plugin)
However, if there is an obstacle, the character will very abruptly stop. Even if it's just at a corner or if the angle of movement is very small.
Is there a clean and efficient way to smooth the collisions and make my character move or slide against the obstacle when moving at an angle?
I've tried 2 things, unsuccessfully:
-First I thought I had to know what was the position of the obstacle compared to the character. I've created some kind of sprite on each sides to detect overlap and know what where was the wall.
Then knowing that I use the direction angle to move the position of the characters on X or Y.
However. It works if I'm checking only one dimension but if there is 2 at the same time, it doesn't really behave smoothly and even jump sometimes(if the characters is in a corner for example)
The think the solution will tend toward this idea but I was wondering if anyone have a clear example of how to achieve that idea.
-The other idea is a bit clunky. If there is contact with obstacle, I use a pathfinding behavior to go around. It works but it's a bit slow and not really what I had in mind..
If anyone as a suggestion, please let me know!
Thank you.