先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace RootMotion.Demos
|
|
{
|
|
// Adds simple FK rotation offset to bones.
|
|
public class FKOffset : MonoBehaviour
|
|
{
|
|
[System.Serializable]
|
|
public class Offset
|
|
{
|
|
[HideInInspector] public string name;
|
|
public HumanBodyBones bone;
|
|
public Vector3 rotationOffset;
|
|
|
|
private Transform t;
|
|
|
|
public void Apply(Animator animator)
|
|
{
|
|
if (t == null) t = animator.GetBoneTransform(bone);
|
|
if (t == null) return;
|
|
|
|
t.localRotation *= Quaternion.Euler(rotationOffset);
|
|
}
|
|
}
|
|
|
|
public Offset[] offsets;
|
|
|
|
private Animator animator;
|
|
|
|
private void Start()
|
|
{
|
|
animator = GetComponent<Animator>();
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
foreach (Offset offset in offsets)
|
|
{
|
|
offset.Apply(animator);
|
|
}
|
|
}
|
|
|
|
private void OnDrawGizmosSelected()
|
|
{
|
|
foreach (Offset offset in offsets)
|
|
{
|
|
offset.name = offset.bone.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|