diff --git a/Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs b/Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs new file mode 100644 index 000000000..1e6f49d3f --- /dev/null +++ b/Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs @@ -0,0 +1,28 @@ +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); + } + } +} diff --git a/Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs.meta b/Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs.meta new file mode 100644 index 000000000..3af9542c1 --- /dev/null +++ b/Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e68be7adce7f09d4287af62a2bac63d7 +timeCreated: 1545891764 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: