Add teleporting to your Normcore app
Hey there! If you’ve followed along with our Adding AR/VR avatars and voice chat, you might be wondering how to allow for teleporting the player avatar around the scene. We can do this in a few quick steps. To get started, create a new Unity project, and download the latest Normcore and import it into your project.
First, let’s start with the Realtime + VR Player example scene, from Normal > Examples > VR Player. It’s pretty straightforward, and includes everything we need for a basic multiplayer scene with player avatars. Go ahead and save it as a new scene to work from.
The steps in this guide are similar whether you’re wanting to use SteamVR, the Oculus Integration, or some other plugin that allows for locomotion.
Adding a teleporter
If you add an OVRPlayerController or SteamVR Player + Teleporting prefab, everything matches up properly with our head and hands. However, when you move the player around the scene, the avatar is left behind. This is because the avatar is grabbing the headset and controller positions directly, so when you move your Player rig, it’s unaware of the changes. Luckily, it’s super easy for us to fix this.
Select the Realtime + VR Player component from the Hierarchy, and take a look at the inspector. In it, you’ll see there’s a Realtime Avatar Manager component. This is what what handles spawning avatars and tracking the local player position.
You’ll notice it also has a Local Player section. This is where we can wire up head and hand transforms for Normcore to track instead. This is what we can use for ensuring our Normcore avatar tracks along with our teleported avatar, by hooking up our SteamVR Player or OVRCameraRig and its respective head and hand objects to the local player transforms.
Let’s go ahead and do that now. Drag in your Player (SteamVR) or OVRCameraRig (Oculus) to the root Player transform slot, and then hook up the respective head and hand objects.
Hook up your root player rig, head, and hand transforms to the Local Player fields in Realtime Avatar Manager.
And that’s it! Let’s go ahead and hit Play and try moving around the scene (or teleporting if using SteamVR) - you should be able to see your player avatar track along with your teleported camera rig.
Success! We can now move our player around the map and have our avatar track along with us.