private void EngineRender_MouseMove(object sender, MouseEventArgs e) { int dx = m_lastMouseX - e.X; int dy = m_lastMouseY - e.Y; if (e.Button == MouseButtons.Left) { if (!m_mainForm.IsCtrlPressed()) { //MOVE OBJECT HERE if (m_selectedObject != null && m_currentMouseAction.Length != 0) { CLI.ManagedVector3 p = m_selectedObject.GetTransform(); switch (m_currentMouseAction) { case "transformY": p.y += dy; break; default: break; } m_selectedObject.SetTransform(p); } } else { m_mainForm.GetCameraControl().GetWrapper().RotateAroundAxis((float)-dx, (float)dy); //m_mainForm.GetCameraControl().GetWrapper().Move((float)-dx*2.0f, (float)-dy*2.0f); } } else if (e.Button == MouseButtons.Middle) { m_mainForm.GetCameraControl().GetWrapper().Move((float)-dx * 2.0f, (float)-dy * 2.0f); } else { } m_lastMouseX = e.X; m_lastMouseY = e.Y; }
private void UpdateValues() { if (m_zobObjectWrapper != null && m_zobObjectWrapper.IsValid()) { CLI.ManagedVector3 p = m_zobObjectWrapper.GetTransform(); CLI.ManagedVector3 r = m_zobObjectWrapper.GetRotation(); CLI.ManagedVector3 s = m_zobObjectWrapper.GetScale(); float px = p.x; float py = p.y; float pz = p.z; float rx = r.x; float ry = r.y; float rz = r.z; float sx = s.x; float sy = s.y; float sz = s.z; float f; if (float.TryParse(zobPosX.Text, out f)) { p.x = f; } if (float.TryParse(zobPosY.Text, out f)) { p.y = f; } if (float.TryParse(zobPosZ.Text, out f)) { p.z = f; } if (float.TryParse(zobRotX.Text, out f)) { r.x = f; } if (float.TryParse(zobRotY.Text, out f)) { r.y = f; } if (float.TryParse(zobRotZ.Text, out f)) { r.z = f; } if (float.TryParse(zobScaleX.Text, out f)) { s.x = f; } if (float.TryParse(zobScaleY.Text, out f)) { s.y = f; } if (float.TryParse(zobScaleZ.Text, out f)) { s.z = f; } m_zobObjectWrapper.SetTransform(p); m_zobObjectWrapper.SetRotation(r); m_zobObjectWrapper.SetScale(s); SetValues(); } }