TransWikia.com

Teleporting player around a corner that face a specific direction

Arqade Asked by Zeaser on April 29, 2021

I want to build some kind of non euclidian room in minecraft, where a player should be able to go 2..infinite amount of times around a corner, until he went full cyrcle. But it should only work in one direction. For example it might take 7 corners if you go clockwise and 4 corners counterclockwise.

Here on 0:42 you can see what i want to achive:
non euclidian geometry

In order to achive that i use command blocks to teleport the player on a point A, where he faces positive x direction, relative to his own offset to point B, where he faces positive y direction:
enter image description here

I tried using this command:

execute at @a[​X=A,Y=B, Z=C, distance=0..4] run tp @p ~-10 ~ ~-10 90 0

I am facing now three problems :

  1. I don’t know how to check which direction the player is facing at given coordinate.

  2. When teleporting the player back while he is moving in x direction, the movement towards x
    stays after the teleportation. In my case i want him, if he moves in x direction before teleportation, to move in y direction after
    the teleportation.

  3. Since all rooms are exactly the same, the player should be teleported to the previous room facing now the previous direction. But after
    teleportation the position is slightly off. Imagine if you move in X direction, there are 4 possible Y coordinates to be teleported(Y1, Y2, Y3, Y4). Depending on which one you get teleported you should get to a different X coordinate
    (Y1 -> X1,.., Y4 -> X4), so the distances to the walls are the exact same. But how it now works is, that it doesnt matter in which Y you are, you will always get to the same X.

    For that reason I created a little formula, that would keep the distances to the walls the same, after teleportation. But i cant use the formula nor can I store the result and use it for the teleportation

Any suggestions?

2 Answers

SOLUTION FOR PROBLEM 1:

Command:

   execute as @p at @a[x=394,y=122,z=94,distance=0..3] anchored eyes
   facing entity @e[sort=nearest,limit=1,type=!minecraft:player] eyes   
   anchored feet positioned ^ ^ ^1 rotated as @s positioned ^ ^ ^-1 if
   entity @s[distance=0..0.3] run tp @p ~-7 ~ ~11 180 0

This command will execute if a player enters given coordinates with radius 3 and faces the eyes of the entity. The entity can be anything you want. In my case I use amor stands. Then it will anchor to the players feet and move one block towards the entity. After that it rotates to the direction the player was looking and moves one block backwards. Now if the player is found in a 0.3 radius, we can assume, that the player is looking at the armor stand and will now be teleported to given coordinates.

Correct answer by Zeaser on April 29, 2021

All you have to do is /tp playername coords facing another coords For example Your Name Is GachaLelouch and the coords Is 1 2 3, All you have to do is /tp GachaLelouch 1 2 3 facing 1 2 3 If you want it to point towards a player you do /tp GachaLelouch 1 2 3 facing @p This command can't work if you teleport another player to another player.. You can do /execute GachaLelouch ~~~ tp GachaLelouch2 ~~~ facing 1 2 3

Answered by GachaLelouch on April 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP