mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-12 22:10:11 -05:00
Added VRMFirstPersonEditor #66
This commit is contained in:
28
Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs
Normal file
28
Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs
Normal file
@@ -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
Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs.meta
Normal file
12
Scripts/FirstPerson/Editor/VRMFirstPersonEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e68be7adce7f09d4287af62a2bac63d7
|
||||
timeCreated: 1545891764
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user