Just a simple question to see if anyone knows the answer to… Is there a way to prevent the player(A) from not jumping onto the enemy(B) whether it be a 2D or 3D game (without removing the jump function)? Cant really think of any algorithm except using character colliders, but no idea what to do with them.
Thanks for any reply.
you add a box collider tall enough to block the player… and if you are afraid that the box collider might be too tall to collide with other objects, for example: when enemy B try to enter a room through a small door but the box collider that was preventing it… assign it to a different layer…
I guess its a possibility but seems a little unrealistic that you cannot jump over the enemy, as if something (a collider in this case) is in the way… I was looking at other games that took different views in the problem and I remember one game had it where the player jumps on the shoulders of the enemy then jumps off, which seems more realistic but complex to script, like how to script the player jumping off the enemies shoulders.
A simpler way, if you want to allow the player to “think” they have the “choice” to jump over the player, but really can’t, is to take a cue from Pixar. In Incredibles, Mr. Incredible goes to make a jump over a robot, but the robot AI anticipates the jump and swats him out of the sky.
Having your enemy execute some sort of quick vertical attack to shut-down the player’s jump is much easier than a grapple animation where the player “lands” on the enemy’s shoulders and flips off (or whatever).
Seems like a great algorithm, but im trying to figure out a way when the AI will notice the jump, im thinking maybe a collider is the best way, a raycast seems harder. And when the ai “swats” the player out, how would you script the player to fall down or in otherwards jump back to where he started.