Pre-solve Collision
Hi, guys
I'm pretty much a beginner in game developing, and I am not aware of the features that could help me solving this specific problem I am about to describe. Therefore, I am here for any advice that could helpful. I am already grateful for your attention and your patience.
At the moment I am working on a simple platformer game, in which the character is able to perform a short teleport within a range. This teleport is also able to go through colliders, which means it is possible to across walls. The main problem I am having to deal with is when the character enters a collider, and the collision needs to be solved. I can't teleport the player inside the collider, because the collision is solved sliding the player outside of it, and it sounds pretty weird when playing. I tried to solve this problem with a couple of ways, using a bunch of raycasts... However, I would be much easier if I could just simulate the collision before it actually is visible to the player. Even though the blink would not actually work literally as how the collision would be solved (cases 5 and 6 in the image below), it would be much easier if I could do it. This is pretty much how it would work:
Purple is player before the teleport.
Green is player after the teleport.
Red is player's teleport direction.
Gray is a wall/collider.
I am not sure if pre-solving the collision is still the best idea, but if you have any clue of how this problem could be solved, I will be thankful for your answer.
Your answer
Follow this Question
Related Questions
2D Cast Problem 0 Answers
RigidBody2D.AddForce() horizontally is not working! 2 Answers
Wall collision slowing vertical jump 0 Answers
Unity 2d random Enemy and random direction movement on spawn. 0 Answers