Problem with chained teleports not ending up with the correct end location after calculating location vectors

I have recorded a video where i tried to show off the problem along with the blueprint code for my project.

I am working on a 3D platformer game where one of the core movement mechanics is a sort of teleportation. It works in the way that, when holding down left-click, you can press WASD, Shift or Space, and it will add a teleport in that direction to an array. When you let go of the left mouse button, it loops through the array of teleports and performs all the teleports so you end up at a new location. So the gimmick is that you can chain teleports together and then it’ll do all of them at once. The math behind it is that when holding down left-click, if you press one of the buttons for a teleport, a vector is made with a length of one in the direction for a teleport. For example, if you press W you get the vector (0, 1, 0) and if you press S you get the vector (0, -1, 0) and so on. This vector is then split into it’s components, and the components get multiplied with the corresponding Actor Forward Vector, Actor Right Vector, or Actor Up Vector fo the player, so instead of having a unit vector in the direction in terms of the world coordinates, it gets rotated so a W press ends up with a vector of length 1 in the foward direction for the player. This vector is then multiplied by 200, to make it longer. Then the previous teleport vector is added to this vector (in the case of the first teleport a 0-vector will be added). This becomes the teleport vector of this teleport. It is then saved in a vector variable so it can be added to the next teleport in the chain. After that, the location of the player is added to the teleport vector, so instead of having a vector from (0, 0, 0), you end up with the end point of where you should teleport to. This point is then saved in an array that we can later loop through to perform all the teleports. The point is also used to spawn an orb to tell you where your teleport location will be.

The problem then is that, as you can see in the video, the teleports don’t send you to the correct location. Each teleport should add 200 in a direction depending on what button you pressed, so if you press W that would add 200 in your relative forward direction, and if you press W again it should add another 200 in your relative forward direction for the teleports that get queued up. But there seems to be a problem with when the previous teleport vector is added to the new one. If you were to press W twice, the first foward vector would be calculated correctly to 200 units in front of you, but for the location of the second forward vector, instead of ending up another 200 units further foward, it only ends up somewhere near 300 units, and it seems to occur in the way that the new vector is calculated correctly, but when the previous vector is added to the new vector to calculate the total vector, while the string printed out would indeed show that it had been added correctly, you can clearly see from the orbs that they don’t actually end up being 200 units away from each other. The same thing happens if you press W and then press D. The first orb is placed correctly, but instead of the second orb being placed 200 units in front and 200 units to the right of the character, it gets placed somewhere around 100 units in front of the character, but still 200 units to the right of the character. If you chain more together (you can chain up to 4) it seems like the same thing occurs, so if you press W once then D twice you end up somewhere around 100 units in front and somewhere around 300 units to the right.

I have no idea why this is occuring, as it doesn’t seem to be a problem with the math, and would like to know what i can do to fix it. If i multiply the previous vector that is added to the new vector with 2, since it seemed like the previous vector simply got halved for some reason, even stranger bugs start to appear, so i don’t even know how to start approaching how to fix this problem. If you need any more information to help me fix the problem, please tell me and i will provide it as quickly as possible.

Hey @MaggyMage

you could maybe just have a threshold problem with one of your input actions.
But there could also be a problem with all those booleans and branches. I just skipped through the video but there where some parts I would do different.

UE53_ChainedTeleports.zip (84.3 KB)

This is in the character:

Enable Enhanced Input:

Camera:

Teleport to the last sphere:

Reset the data, delete spheres and start from character location:

Use movement input to also place the spheres:

Teleport to each sphere (alternative):

Overiew:

The IA actions are the standard ThirdPerson inputs and the IA_ExecuteTeleport ist just LeftMouseButton.