33 lines
985 B
C#
33 lines
985 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace BoneSync.Data
|
|
{
|
|
|
|
public static class SimpleTransformExtensions
|
|
{
|
|
public static void ApplySimpleTransform(this Transform transform, SimpleSyncTransform simpleTransform)
|
|
{
|
|
transform.position = simpleTransform.position;
|
|
transform.rotation = simpleTransform.rotation;
|
|
if (simpleTransform.scale.HasValue) transform.localScale = simpleTransform.scale.Value;
|
|
}
|
|
}
|
|
public struct SimpleSyncTransform
|
|
{
|
|
public Vector3 position;
|
|
public Quaternion rotation;
|
|
public Vector3? scale;
|
|
public SimpleSyncTransform(Transform transform, bool withScale = true)
|
|
{
|
|
position = transform.position;
|
|
rotation = transform.rotation;
|
|
scale = withScale ? transform.localScale : (Vector3?)null;
|
|
}
|
|
}
|
|
}
|