mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-15 07:00:10 -05:00
29 lines
733 B
C#
29 lines
733 B
C#
using UnityEditor;
|
|
|
|
|
|
namespace VRM
|
|
{
|
|
[CustomEditor(typeof(VRMFirstPerson))]
|
|
class VRMFirstPersonEditor : Editor
|
|
{
|
|
void OnSceneGUI()
|
|
{
|
|
var component = target as VRMFirstPerson;
|
|
|
|
var head = component.FirstPersonBone;
|
|
if (head == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
var worldOffset = head.localToWorldMatrix.MultiplyPoint(component.FirstPersonOffset);
|
|
worldOffset = Handles.PositionHandle(worldOffset, head.rotation);
|
|
|
|
Handles.Label(worldOffset, "FirstPersonOffset");
|
|
|
|
component.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset);
|
|
}
|
|
}
|
|
}
|