private void FireRotateEvent(Vector2 prev_diff_vector, Vector2 diff_vector, float angle) { Vector3 cross = Vector3.Cross(prev_diff_vector, diff_vector); RotationDirections dir = RotationDirections.CW; if (cross.z > 0) { dir = RotationDirections.CCW; //Debug.Log($"Rotate Counter CW {angle}"); } else if (cross.z < 0) { dir = RotationDirections.CW; //Debug.Log($"Rotate CW {angle}"); } Vector2 midPoint = GetMidPoint(trackedFinger1.position, trackedFinger2.position); GameObject hitObj = GetHit(midPoint); OnRotateEventArg args = new OnRotateEventArg(trackedFinger1, trackedFinger2, angle, dir, hitObj); if (OnRotate != null) { OnRotate(this, args); } if (hitObj != null) { IRotated rot = hitObj.GetComponent <IRotated>(); if (rot != null) { rot.OnRotate(args); } } }
public void rotate(IRotated iRotated) { iRotated.rotation += velocity.X * sensitivity; }
public void doRotate(IRotated iRotated) { iRotated.rotation += velocity.X / 500; }