How do you teleport a player relatively but without finishing at 0.5 on each axis?

Basically I have a command block on repeat without need of redstone and the command is:

execute if entity @p[dy=1] run tp @p ~7 80 ~-20

The purpose of it is to attempt seamless teleport which has worked... well sort of. When i walk over it, it teleports me to the correct coordinates but always finishing at 0.5. What I mean is this, if my x coordinate is 123.2152 then if i teleport relatively to -2 blocks then it ends up at 121.5 not 121.2152.

How do I get it to end up at not 0.5?


Solution 1:

You just have to add .0 to turn it into an exact number:

/tp @s 100.0 100.0 100.0

teleports you exactly to 100.0 100.0 100.0 without centering you in the block.

Btw, this is not a behaviour of the relative teleport, so it wouldn't change anything in your example command. I assume your example command is in a command block, in that case it teleports you relative to the command block bottom center, so you would have to subtract 0.5 from the x and z coordinate to end up on a block corner.