You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
610 B
C#

using MalbersAnimations.Scriptables;
using UnityEngine;
namespace MalbersAnimations
{
/// <summary> Uses a transform as the UpVector </summary>
[AddComponentMenu("Malbers/Utilities/Tools/UpVector Transform")]
public class UpVectorTransform : MonoBehaviour
{
public GameObjectReference source;
private IGravity upVector;
void Start()
{
if (source != null) upVector = source.Value.GetComponentInChildren<IGravity>();
}
void Update()
{
if (upVector != null) transform.up = upVector.UpVector;
}
}
}