I have a melee enemy and I need it to “jump” to the player position if the player is above or below the enemy. (“Jump to” location calculated with Environmental Query System)
The problem with this set up is that the character will not actually be moved. If I use a flat value instead of the VInterp, it will teleport to the spot, but trying to move it smoothly will result in it staying in place. AI move to will not work since it doesn’t allow for air movement.
I also tried using launch character node, but I couldn’t find a way to have the character land in the exact spot I want.
To summarize: I want to find a way to smoothly transition the character from position A to position B. It can be done by any means, like interpolating between 2 values or adding velocity to the character, but it needs to land in a predisposed spot with little to no deviation.
(btw the reason for your vinterp not working is because you’re constantly updating the actor’s location, while it should be stored in a variable at the start of the action for the vinterp node to work as expected)
No, unfortunately I can’t. The jumping has to be dynamic and the links have to be placed manually . I already have both position A and B figured out, I just need to somehow move the character between the two.
Also, I don’t think there’s a way to filter out which characters can “see” the link and I don’t want other NPCs to be able to jump (would be gladly proven wrong though).
I like your wish for a dynamic approach! That’s also how I roll
In that case, you can simply use the Jump & Stop Jumping nodes to make your AI jump, and also make sure it’s air control is set to a high value which you can adjust from the character movement component’s details window. (And yes we could also use a different movement mode to avoid this but where else are you gonna use air control for your AI right?) Then, activate an Add Movement Input node for the duration of the whole jumping process and insert your AI’s forward vector into that node’s direction pin.
Now the last step would be implementing some calculations to make your AI jump correctly but you mentioned you’ve already done that. So this should be it!
You said you handle the calculation of jumping conditions based on collisions right? By probably using line traces. You can just adjust the trace channel of your line trace to make your AI ignore the player in that calculation. If none of the default ones fit in your use case (which are visibility & camera and they both include pawns I believe so they don’t) you can create one your own!
Here’s a tutorial on custom trace channels:
Like I explained in my initial reply, you can fix your vinterp node and make it work But why would you prefer it over a proper jumping?
Also I didn’t get what you meant by “physics”. There are no physics included here. Did you mean the character movement component?
As I also explained, I don’t know how. That’s why I made this post.
But why would you prefer it over a proper jumping?
I’d prefer it over proper jumping because it’s more precise. Just a linear translation between 2 points.
Also I didn’t get what you meant by “physics”. There are no physics included here.
And yes, doing a “proper” jump requires the physics engine to add velocity to a character actor. If you don’t believe me, you can set the gravity in your map to a negative amount and the jump will break as the character floats off into space. Linear translation wouldn’t do that. I guess you could argue that the physics engine is still involved since collisions still work during linear movement, but technically they aren’t necessary.
What I meant by physics was this setting right here:
Like I said, I think you’re referring to the character movement component.
Did you manage to pull my last suggestion off? Did you try it yet? And if so, how did it go? If you encounter any issues, you can send the related screenshots for me to take a look at
Oh, okay, I see I just misunderstood. Sorry, I made the post when it was very late and now I’m reading it again just after waking up .
By “physics” I meant like adding velocity to an object with weight, but now I understand the confusion. I somehow missed your initial comment about storing the location variable.
The suggestion with allowing the enemy to jump was good and it worked fine, except for the fact that if the player squeezed themselves under the jumping enemy, it would launch the enemy upwards. Enemy would also sometimes get stuck on some things.
As per the Vinterp, for some reason it doesn’t actually interpolate, instead it repeats the enemy initial position indefinitely, even after using a variable for the initial position.
Seems like all there’s left to do is adjusting your algorithm that determines how the AI should jump.
You can also change the collision settings for your AI. Here is the documentation of it. You can simply set the pawn to ignore under the object responses section of your AI’s capsule component.
I think it still doesn’t store any values permanently since your task also gets executed continuously. If you don’t have a momentary event to trigger this action of your AI, then you can use a Sequence node to branch your existing code, place a Do Once node after one of the pins of the sequence while the other moves on with the rest of your code and then set that vector type variable of yours after the Do Once node. You can also reset the Do Once node when a desired condition is met, but for debugging purposes, don’t reset it just yet.
Then the enemy phases trough the player which is even worse. The enemy has to collide with the player, but also has to not land on the player. As per my algorithm, I’d have to continuously adjust the enemy position mid air to ensure that the player did not move into a spot the AI tried jumping to. Continuously adjusting position between 2 points is what interpolation does.
I don’t think I understand your objective. The AI getting launched away from the player when it was about to land on it is the solution to this problem which is enabled by default. Could you please explain what you want more clearly?
You can just redo that approach you didn’t like the outcome of but while their capsule components are overlapping, you can make it seem like the characters aren’t by playing a falling animation for the player when that happens. Or if that’s a first person game you can adjust the camera accordingly. This was my guess for a solution since I didn’t quite get what you want.
No I actually got a little bit confused. Here’s the correct syntax:
My point on having a stored variable is valid on timelines though. That was in fact where my mind went to. Btw you shouldn’t be using interps while you’re already using timelines. You can just use a float track and a lerp node.
The problem: Player jumps onto a high place, makes it impossible to reach them
The (proposed) solution: Enemy jumps up to the unreachable spot.
If it gets bounced off: the enemy falls down again and the problem persists.
If it clips into the player: then the player can phase trough it and avoid the melee attack.
The enemy has to land just close enough to be able to return to it’s usual “approach the player and bit them” routine.
Unfortunately I couldn’t get this to work either within the behavior.
I just copy pasted the code from the behavior into a blueprint without any modification. That’s why I called it a “quick test”. Usually I’d use an event tick, but it’s currently occupied, so I had to improvise to make sure this solution works first.
Either way, putting the interpolation system in the blueprint and calling it from the behavior seems to be the solution, as the same VInterp node setup which worked in blueprint wouldn’t work in the behavior task.
You can adjust your code which determines how the AI should jump. For example, if it detects the player getting on the way before the jump starts it should choose to jump a little bit closer.
With this applied, the player can avoid the AI jumping near himself by camping on the edge of an elevation. To avoid this, you can use the “Launch Character” node. That node has a launch velocity pin. You can get the AI’s forward vector when the collision begins, multiply it by a desired value and plug it in there. Now the AI doesn’t have a reason to restrict it’s jump target.
My answer above is a solution to your current issue that you can add onto that jumping logic I’ve previously suggested. So I recommend not using the other thing where you use the Set Actor Location node. But just to eliminate your confusion on timers and interps, I can take a look at your implementation and hopefully can spot the mistakes. Though before sending the screenshots of your attempt, try inspecting the execution flow of your behavior tree while you’re playing your game in the editor. You can also use breakpoints to further investigate on the issue. Maybe it’s because your task getting aborted sooner than expected.