A wall wrapper is like a spider, it walks on walls and wraps around, say, a rectangular block.
I’ve been looking for a solution online but I couldn’t find a solution that works on all kinds of terrain. So far, this is the best solution I found. It works fine in most cases, but I need to be able to handle these kinds of scenarios: (See attachment)
I kinda know how to solve scenario #1… throw a short raycast to the direction of movement just like what the article said… but I’m not sure how to solve #2 and #3.
Can anyone help me? Can you share some references or paste some code snippets? btw, i’m doing this in 2d. TIA!
1 Like
For #2 and #3, I was thinking of doing a “_|” raycast when my down and right raycast don’t hit anything… What do you all think? I’m gonna give it a try.
Seems like what I was starting to write, when I stopped because I had no real solution on how to find the next valid wall portion.
A while ago I looked into doing this, and managed to get something sort of working… Can’t find the code right now, might look for it tomorrow…
For #3 you could draw a short ray down, if it doesn’t hit anything, then to another raycast offset by the length of the first raycast with a -transform.forward. That could work for number three too, then you would just have to rotate the player to the normal the raycast returns… Good luck…
Yea, that’s kinda what I mean by “_|” raycast lol. I’m still implementing it… Will maybe paste a working code here if I get it working…