This website uses cookies to improve our services and deliver relevant ads.
By interacting with this site, you agree to this use. For more information, see our Cookies Policy
This version of the guide is out of date. Click here for the latest version.
The Avatar Unity package contains several prefabs you can drop into your existing Unity projects. This tutorial shows you how to start using them.
The LocalAvatar prefab renders the player's avatar and hands. You can choose which parts of the avatar you want to render: body, hands, and Touch controllers.
To render avatar hands with controllers:
Click Play to test. Try out the built-in hand poses and animations by playing with the Touch controllers.

Click Play to test. Squeeze and release the grips and triggers on the Touch controllers and observe how the finger joints transform to change hand poses. It is possible to add hand poses outside the range of these movements; we talk more about this in Custom Touch Grip Poses.


The avatar packet recording system saves avatar movement data as packets you can send across a network to play back on a remote system. Lets take a quick tour of the RemoteLoopbackManager script.
Open the RemoteLoopback scene in OvrAvatar > Samples > RemoteLoopback.
We set RecordPackets to true to start the avatar packet recording system. We also subscribe to the event handler PacketRecorded so that we can trigger other actions each time a packet is recorded.
void Start () {
LocalAvatar.RecordPackets = true;
LocalAvatar.PacketRecorded += OnLocalAvatarPacketRecorded;
}Each time a packet is recorded, our code places the packet into a memory stream we are using as a stand-in for a real network layer.
void OnLocalAvatarPacketRecorded(object sender, args)
{
using (MemoryStream outputStream = new MemoryStream())
{
BinaryWriter writer = new BinaryWriter(outputStream);
writer.Write(packetSequence++);
args.Packet.Write(outputStream);
SendPacketData(outputStream.ToArray());
}
}The remainder of our code receives the packet from the memory stream for playback on our loopback avatar object.
void SendPacketData(byte[] data)
{
ReceivePacketData(data);
}
void ReceivePacketData(byte[] data)
{
using (MemoryStream inputStream = new MemoryStream(data))
{
BinaryReader reader = new BinaryReader(inputStream);
int sequence = reader.ReadInt32();
OvrAvatarPacket packet = OvrAvatarPacket.Read(inputStream);
LoopbackAvatar.GetComponent<OvrAvatarRemoteDriver>().QueuePacket(sequence, packet);
}
}