Translating offset vectors between two locations

Greetings kind reader,

Starting with a known location and knowing an object’s position relative to that location, I need to determine the position with the same offset from another location. I plain English, I am teleporting a player between two identical rooms without him/her being able to tell it happened.

There are simplied images below that should help explain. In all cases, the known location is the yellow sphere, the green sphere is the object (player) whose position relative to the yellow sphere is known, the blue sphere is the second known location and the location of the red sphere (where the player is teleported to) is what needs to be determined. The multicolored lines between the spheres are just there for scale.

I have a feeling this is one of those things that is simple once you know what function(s) to use, but I don’t and it has been ages since I used vector math in school. A combination of trial and error and monkey see monkey do with FQuat, FTransform, FRotator and FVector has led me to a solution for this simple case and ones where the two locations are at varying angles and distances from the Z (blue line) axis.

But I have not been able to convert that solution to one where the floor is tilted as below, where the tilt is known.

And what I really need is to be able to do it for floors with differing known tilts from horizontal and differing known rotations around Z, as shown below.

Ideally it would be nice to be able to do this for a start location with arbitrary known location and rotation and a destination with arbitrary known location and rotation, and I am hoping that with your help it will be possible to do this.

Thanks for taking the time to look at this,


I’m not sure, but I think a nice try would be to make a substraction between the green and yellow point. Then, you know the relative distance between both of them. Then, you should add this resulting vector to the position of the blue sphere, and teleport there the player.

I’m not sure if I understood you correctly, but if your levels are mirrored or something like that, you just have to change the value of the mirrored axis. For the rotation issue, it’s a bit more complicated (but not so much!). I would calculate the vector between the green and yelow units in local, and apply it to the blue sphere in local (so it calculates the position according the rotations!)

It’s a quite simplistic and fast answer, but I hope this helped! :T