question

BahadrAKAR-0421 avatar image
0 Votes"
BahadrAKAR-0421 asked SethDu-MSFT edited

Use MRTK button for teleport

Hi there,

How can I set up buttons as a teleport feature? For example, there is a car on unity and I want to see the front and back sides of the car. I will create buttons whose name is front and back. When I press front it will teleport me to the front side of the car and when I press back it will teleport me to the backside of the car.

Thank you,

hololens-development
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SethDu-MSFT avatar image
0 Votes"
SethDu-MSFT answered SethDu-MSFT edited

Hello, welcome to Microsoft Q&A,

Please note that for HoloLens apps, it is not recommended to "teleport" a player because as it is immersive, HoloLens is always centered on the wearer's actual location.

However, if you want to click a button to move a player to a specific place, you may create a MRTK button in your project, then assign an on-click event for this item. Below are the steps, and please note that this action is not "teleporting" a player to a specific position, instead, it moves all the holograms around the player.


  1. Drag and Drop a MRTK pressable button from Mixed Reality Toolkit tools. (It is recommended to implement this plugin from MR feature Tools).

  2. Create a custom script and add the following codes. Assign this script to any game object.

    using Microsoft.MixedReality.Toolkit;

    Vector3 frontSeatPosition = new Vector3(0, 0, 0); // change the position as you want
    Vector3 frontSearRotation = new Vector3(0, 0, 0); //
    public void movePlayerPosition()
    {
    MixedRealityPlayspace.Transform.Translate(frontSeatPosition);
    MixedRealityPlayspace.Transform.Rotate(frontSearRotation);
    }


  3. In the “interactable” component of the pressable button, select the game object with the script attached in OnClick() section, then select the movePlayerPosition()

Try to click the button during the play and test in the new position.


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.