123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using UnityEngine;
- namespace COM3D2.MeidoPhotoStudio.Plugin
- {
- using Input = InputManager;
- internal class DragPointPelvis : DragPointMeido
- {
- private Quaternion pelvisRotation;
- protected override void ApplyDragType()
- {
- if (CurrentDragType == DragType.Ignore) ApplyProperties();
- else if (IsBone) ApplyProperties(false, false, false);
- else ApplyProperties(CurrentDragType != DragType.None, false, false);
- }
- protected override void UpdateDragType()
- {
- if (Input.Alt && !Input.Control)
- {
- CurrentDragType = Input.Shift ? DragType.RotLocalY : DragType.RotLocalXZ;
- }
- else
- {
- CurrentDragType = OtherDragType() ? DragType.Ignore : DragType.None;
- }
- }
- protected override void OnMouseDown()
- {
- base.OnMouseDown();
- pelvisRotation = MyObject.rotation;
- }
- protected override void Drag()
- {
- if (CurrentDragType == DragType.None) return;
- if (isPlaying) meido.Stop = true;
- Vector3 mouseDelta = MouseDelta();
- if (CurrentDragType == DragType.RotLocalXZ)
- {
- MyObject.rotation = pelvisRotation;
- MyObject.Rotate(camera.transform.forward, mouseDelta.x / 6f, Space.World);
- MyObject.Rotate(camera.transform.right, mouseDelta.y / 4f, Space.World);
- }
- if (CurrentDragType == DragType.RotLocalY)
- {
- MyObject.rotation = pelvisRotation;
- MyObject.Rotate(Vector3.right * (mouseDelta.x / 2.2f));
- }
- }
- }
- }
|