Skip to content

Commit

Permalink
Added VRMFirstPersonEditor #66
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Dec 27, 2018
1 parent e43ce3e commit ce8c09c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
12 changes: 12 additions & 0 deletions Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce8c09c

Please sign in to comment.