AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
SyncTransform.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 using HoloToolkit.Unity;
6 
7 namespace HoloToolkit.Sharing.SyncModel
8 {
14  public class SyncTransform : SyncObject
15  {
16  [SyncData] public SyncVector3 Position = new SyncVector3("Position");
17  [SyncData] public SyncQuaternion Rotation = new SyncQuaternion("Rotation");
18  [SyncData] public SyncVector3 Scale = new SyncVector3("Scale");
19 
20  public event Action PositionChanged;
21  public event Action RotationChanged;
22  public event Action ScaleChanged;
23 
24  public SyncTransform(string field)
25  : base(field)
26  {
27  Position.ObjectChanged += OnPositionChanged;
28  Rotation.ObjectChanged += OnRotationChanged;
29  Scale.ObjectChanged += OnScaleChanged;
30  }
31 
32  private void OnPositionChanged(SyncObject obj)
33  {
34  PositionChanged.RaiseEvent();
35  }
36 
37  private void OnRotationChanged(SyncObject obj)
38  {
39  RotationChanged.RaiseEvent();
40  }
41 
42  private void OnScaleChanged(SyncObject obj)
43  {
44  ScaleChanged.RaiseEvent();
45  }
46  }
47 }
This class implements the Transform object primitive for the syncing system. It does the heavy liftin...
This class implements the Vector3 object primitive for the syncing system. It does the heavy lifting ...
Definition: SyncVector3.cs:12
The SyncObject class is a container object that can hold multiple SyncPrimitives. ...
Definition: SyncObject.cs:21
This class implements the Quaternion object primitive for the syncing system. It does the heavy lifti...