模型旋转预览
This commit is contained in:
@@ -64,33 +64,52 @@ namespace NBF
|
||||
{
|
||||
var dragObj = TouchHolder;
|
||||
var gesture1 = new SwipeGesture(dragObj);
|
||||
gesture1.onBegin.Set(OnSwipeBegin);
|
||||
gesture1.onMove.Set(OnSwipeMove);
|
||||
gesture1.onEnd.Set(OnSwipeEnd);
|
||||
}
|
||||
|
||||
private void OnSwipeBegin(EventContext context)
|
||||
{
|
||||
var gesture = context.sender as SwipeGesture;
|
||||
if (gesture == null) return;
|
||||
if (context.inputEvent.button == 0)
|
||||
{
|
||||
_renderImage.StartRotate(gesture.position);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSwipeMove(EventContext context)
|
||||
{
|
||||
var gesture = context.sender as SwipeGesture;
|
||||
if (gesture == null) return;
|
||||
var v = Vector3.zero;
|
||||
|
||||
|
||||
if (context.inputEvent.button == 0)
|
||||
{
|
||||
v.y = -gesture.delta.x * 0.2f;
|
||||
v.z = -gesture.delta.y * 0.2f;
|
||||
if (!gesture.snapping)
|
||||
{
|
||||
v.y = 0;
|
||||
v.z = 0;
|
||||
}
|
||||
|
||||
if (Mathf.Abs(v.y) < 1) //消除手抖影响
|
||||
v.y = 0;
|
||||
if (Mathf.Abs(v.z) < 1) //消除手抖影响
|
||||
v.z = 0;
|
||||
_renderImage.StartRotate(v);
|
||||
_renderImage.UpdateRotation(gesture.position);
|
||||
}
|
||||
|
||||
// var gesture = context.sender as SwipeGesture;
|
||||
// if (gesture == null) return;
|
||||
// var v = Vector3.zero;
|
||||
//
|
||||
//
|
||||
// if (context.inputEvent.button == 0)
|
||||
// {
|
||||
// v.y = -gesture.delta.x * 0.2f;
|
||||
// v.z = -gesture.delta.y * 0.2f;
|
||||
// if (!gesture.snapping)
|
||||
// {
|
||||
// v.y = 0;
|
||||
// v.z = 0;
|
||||
// }
|
||||
//
|
||||
// if (Mathf.Abs(v.y) < 1) //消除手抖影响
|
||||
// v.y = 0;
|
||||
// if (Mathf.Abs(v.z) < 1) //消除手抖影响
|
||||
// v.z = 0;
|
||||
// _renderImage.StartRotate(v);
|
||||
// }
|
||||
}
|
||||
|
||||
private void OnSwipeEnd(EventContext context)
|
||||
|
||||
Reference in New Issue
Block a user