浏览代码

Work on rigs

/main
Thomas ICHÉ 6 年前
当前提交
0e1661cf
共有 6 个文件被更改,包括 66 次插入5 次删除
  1. 2
      Runtime/Rigs/FollowPositionRig.cs
  2. 9
      Runtime/Rigs/LookAtRig.cs
  3. 22
      Runtime/Rigs/FloatingRig.cs
  4. 11
      Runtime/Rigs/FloatingRig.cs.meta
  5. 16
      Runtime/Rigs/RotationRig.cs
  6. 11
      Runtime/Rigs/RotationRig.cs.meta

2
Runtime/Rigs/FollowPositionRig.cs


using UnityEngine;
namespace NaughtyAttributes.Rigs
namespace GameplayIngredients.Rigs
{
public class FollowPositionRig : MonoBehaviour
{

9
Runtime/Rigs/LookAtRig.cs


using System.Collections;
using System.Collections.Generic;
namespace NaughtyAttributes.Rigs
namespace GameplayIngredients.Rigs
public Space UpVectorSpace = Space.World;
transform.LookAt(LookAtTarget, UpVector);
{
transform.LookAt(LookAtTarget, UpVectorSpace == Space.Self? transform.InverseTransformDirection(UpVector).normalized: UpVector.normalized);
}
}
}
}

22
Runtime/Rigs/FloatingRig.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FloatingRig : MonoBehaviour
{
public Vector3 Frequency = new Vector3(4,5,6);
public Vector3 Amplitude = new Vector3(0.0f, 0.2f, 0.0f);
Vector3 m_InitialPosition;
private void Awake()
{
m_InitialPosition = transform.position;
}
private void Update()
{
float t = Time.time;
transform.position = m_InitialPosition + new Vector3(Mathf.Sin(t * Frequency.x) * Amplitude.x, Mathf.Sin(t * Frequency.y) * Amplitude.y, Mathf.Sin(t * Frequency.z) * Amplitude.z);
}
}

11
Runtime/Rigs/FloatingRig.cs.meta


fileFormatVersion: 2
guid: 53b77d3bf7eadf04c9bfda6da44088b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

16
Runtime/Rigs/RotationRig.cs


using UnityEngine;
namespace GameplayIngredients.Rigs
{
public class RotationRig : MonoBehaviour
{
public Space Space = Space.World;
public Vector3 RotationAxis = Vector3.up;
public float RotationSpeed = 30.0f;
void Update()
{
transform.Rotate(RotationAxis.normalized, RotationSpeed * Time.deltaTime, Space);
}
}
}

11
Runtime/Rigs/RotationRig.cs.meta


fileFormatVersion: 2
guid: 7ead6aa8f9c07e741bb74522b9da712b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存