BEAT EM UP - How to make the enemy "orbit" the player???

The question is, how to make the enemy, in a beat em up game, orbit, the player. This can be seen in the arcade version of TMNT by Konami. @ around 1:43 of this video. As is the case of all BEUs, the enemy first achieves Y1 or Y2 by your method of choice, then the “time to attack” or TTA takes place which is usually a small delay before the attack. This is how much time once they achieve Y1 or Y2 before they try to attack. In the case of TMNT, they will punch, kick, jump kick, do a flex / taunt, OR do a half circle from one of the “slots” / Y1 Y2 to the other.

For the sake of simplicity and demonstration. Off an Event Tick feed, I want an enemy (using addactoroffset) to orbit around the player. I have it set so that instead of attack I have access to the event tick once they achieve Y1 or Y2 and it will start this logic, triggers a bool. And for testing purposes I suppose I would the enemy orbit indefinitely and I will figure out a way to reverse the direction or have them do a quarter orbit and return (also seen in TMNT arcade).

Like the illustration shows, I find that Y1 and Y2 feel about right at 100 units from the players Y (could be X depending on how your map and spawn points are rotated). So I suppose the orbit radius needs to also be 100.

Because I am highly allergic to NavMesh, I use a PAWN enemy that is currently moving by addactorworld offset. Currently using around 3.0 on X or Y for the speed.

I asked AI several times about this and seemed to get a different answer about each time I asked. It would be like the Player’s location is where an old school metal compass point would go, and Y1 or Y2 is where the pencil tip would go.

Any idea on what nodes could be used to achieve a simple rotation with the player’s location acting as a center point? Keep in mind this will be using Event Tick fire and will likely end up in a macro so Timeline(s) can’t be used. Any help is appreciated, thanks.

lol. you have the right to use whatever you prefer (at least in my book).

that’s how ai works. it doesn’t know what its saying. even if it always says the same. it doesn’t really understands and might be dogmatic.

what i would do (and have done in my game for a similar “enemy”).

is to have a component to drive this.

use the position of the player as “center”. then have a “radius” and an “angle”. using these 3 you can easily calculate the “target” position. then you animate the angle however you want. you can also animate the radius.

then the enemy tweens/changes it’s position towards the “target” and not the player itself. there are many other cases where you’d want to also aims to the target and not the player. so it’s super common.

or you can simply use the “rotating movement” component and it will be a bit more optimized maybe. and does exactly what i’ve described.

you can set it so that it always rotates around the player.

you might need to play with the parameters. i can’t tell you exactly how from top of my head. but i’m quite certain is doable.

what i don’t know is if your game is 2d or 3d. it looks 2d in your text.

1 Like

orbit should be pretty simple, find the direction towards the player which you must already be doing and then if distance is < 100 rotate that vector 90 degrees and use the same AddActorWorldOffset

1 Like

Thanks all that replied. I finally got something on it. The key was using a certain node.

First thing I did was inside my enemy attack macro, right at the point where the enemy would throw a punch after achieving Y1 or Y1, I made a boolen “P00 Orbitaround?”, I checked if it was false, if so I SET it to true. This diverts my Event Tick fire to where I have access to it for my P00 Orbit around macro.

This works, and you can change rotation from clockwise to counter clockwise by changing the orbit speed float to a negative or positive value. You first subtract your enemy location from your player location (vector), The node I mentioned you need for this is”RotateVectorAroundAxis:” It has 3 inputs - In Vect (which you will plug the output of that last subtraction into), Angle Degree (which you multiply delta time by your orbit speed float, this one is -75), Axis (which you leave X and Y zero and do 1.0 on Z). Then you subtract the output of the RotateVectorAroundAxis with the output of the subtracted player and enemy locations and feed that into an addactorworldoffset driven by an Event Tick. It works but the orbit gets eratic after you move around a bit. To compensate I made two branches checking the distance to P00 hence if it gets too close or too far away that bool is triggered false ending the orbit macro and bring the other movement logic back. The effect of the orbit around can be seen in the video below.