Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save FirstPerson values on GUI correctly #217

Merged
merged 3 commits into from
Mar 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Assets/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEditor;
using UnityEngine;


namespace VRM
Expand All @@ -16,12 +17,17 @@ void OnSceneGUI()
return;
}

EditorGUI.BeginChangeCheck();

var worldOffset = head.localToWorldMatrix.MultiplyPoint(component.FirstPersonOffset);
worldOffset = Handles.PositionHandle(worldOffset, head.rotation);

Handles.Label(worldOffset, "FirstPersonOffset");

if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(component, "Changed FirstPerson");
}
component.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

動作に問題は無いですが、この処理はifの中に入れたほうが良いかもです

Copy link
Contributor Author

@yutopp yutopp Mar 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど確かに。 
0c147dd で対応しました。

}
}
Expand Down