private void Form_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { // Send mousemove message MouseMoveMessage msg = new MouseMoveMessage(); msg.X = e.X; msg.Y = e.Y; Owner.MessagePool.SendMessage(msg); }
public void OnMouseMove(MouseMoveMessage msg) { // Are we rotating? if (rotate) { // Get delta int dx = msg.X - oldmousex; int dy = msg.Y - oldmousey; // Get transform and old rotation Transform transform = Owner.GetComponent<Transform>(); Quaternion oldrotation = transform.LocalRotation; // Calculate pitch and yaw amounts Quaternion pitch = Quaternion.RotationAxis(Util.Vector3Transform(Vector3.UnitX, oldrotation), dy * Sensitivity); Quaternion yaw = Quaternion.RotationAxis(Vector3.UnitY, dx * Sensitivity); // Set new rotation transform.LocalRotation = oldrotation * pitch * yaw; } // Store new coords oldmousex = msg.X; oldmousey = msg.Y; }