Help my AI jump between platforms while focusing on player!

I’m tearing out my hair here, 3 nights working on this (maybe simple) problem! I’ve asked AI, watched vector math videos and I can’t seem to get it through my head :frowning:

All characters in my game have a boost mechanic that takes an input of -1 to 1 forward, and -1 to 1 right. It propels them 750m/s upward and then 750m/s forward/backward + left/right depending on the controller. This is used to jump between platforms, there’s also double boosts but I’ll deal with that later.

So the AI also gets access to this boost mechanic and I was able to get them jumping between the platforms by looking at them and boosting because the forward value is easy to calculate between 0-1. But once you try to have them facing a different way to the target platform the maths is just baffling me.

Here’s the blueprint with all the different nodes I’ve been trying to work with.

and the game arena (each platform is 800 apart from each other)

Screenshot 2023-12-20 192723

As much as I want to solve this for my own self-worth, it’s really made a roadblock!

Any help would be greatly appreciated :heart:

Might want to try Nav Link Proxies. They have an event when an actor reaches a link, which you can use to call a function on a the actor to launch them.

Here’s a pretty good guide on setting them up:

Thanks mate! I have seen Nav Link Proxies before, might have a bit more of a play and see if they will work in my situation.

Good news though, last night out of sheer frustration I changed the blueprint to call Launch Character with world vectors and the boost mechanic is working nicely for AI.

I gotta say, it feels like a hack job though - I really wanted to work out the math for the AI to receive the input like it was a player. I’m sure the character rotation comes in to the equation somewhere…

Nav link may be the most player-like way to do it since the AI will be be deciding where it wants to go, and the link events kind of act like a player mashing a jump button at the location where the jump should start. I’ve used them in 2.5d platform game projects and fully 3d worlds where I want enemies to chase player on top of buildings and obstacles, and it works rather well. Can be a bit weird when the AI misses a jump on the first try, but in a way, that kinda makes it more life-like. As if fighting a player who’s just not good at jumping lol.

1 Like

Hey I cracked the maths, at least for now!

The solution came by multiplying the dot product of the target vector (target location - current location) and the forward and right vectors respectively.

The thing is some platforms require up to 2 boosts so the characters need to recalculate each time they fall below a certain altitude while simultaneously firing at another target.

I’m still definitely going to look in to nav link properly so thanks a lot for the reply mate!

Here’s the current implementation if anyone stumbles across the same issue <3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.