// ====================================================================================== public static float GetAxis(int _player, eAxis _axis) { if (_player > 4 || _player <= 0) { return(0f); } #if UNITY_EDITOR if (_player == 1 && m_manager.m_debugMode) { return(GetDebugAxis(_axis)); } #endif GamePadState gamePadState = GamePad.GetState((PlayerIndex)(_player - 1)); switch (_axis) { case eAxis.HORIZONTAL: return(gamePadState.ThumbSticks.Left.X); case eAxis.VERTICAL: return(gamePadState.ThumbSticks.Left.Y); } return(0f); }
private void drawSquareSurface(float width, float height, float depth, eAxis axis) { GL.glBegin(GL.GL_QUADS); // if there is no texture bind, the glTexCoord2f do nothing switch (axis) { case eAxis.X: GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(width, 0, 0); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(width, 0, depth); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(width, height, depth); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(width, height, 0); break; case eAxis.Y: GL.glVertex3f(0, height, 0); GL.glVertex3f(0, height, depth); GL.glVertex3f(width, height, depth); GL.glVertex3f(width, height, 0); break; case eAxis.Z: GL.glTexCoord2f(0.0f, 0.0f); GL.glVertex3f(0, 0, depth); GL.glTexCoord2f(0.0f, 1.0f); GL.glVertex3f(0, height, depth); GL.glTexCoord2f(1.0f, 1.0f); GL.glVertex3f(width, height, depth); GL.glTexCoord2f(1.0f, 0.0f); GL.glVertex3f(width, 0, depth); break; } GL.glEnd(); }
// ====================================================================================== public static float GetAxis(int _player, eAxis _axis) { #if UNITY_EDITOR if (m_manager.m_pcDebugMode && _player == 1) { return(GetDebugAxis(_axis)); } Debug.Assert(m_manager != null, "InputMgr - Missing InputMgrConfig in Project"); #endif if (_player > 4 || _player <= 0) { return(0f); } GamePadState gamePadState = GamePad.GetState((PlayerIndex)(_player - 1)); if (!gamePadState.IsConnected) { return(0f); } switch (_axis) { case eAxis.HORIZONTAL: return(gamePadState.ThumbSticks.Left.X); case eAxis.VERTICAL: return(gamePadState.ThumbSticks.Left.Y); } return(0f); }
public void Move(double pos, bool isRelative) { try { if (m_bIsUseAxis) { uint duRetCode = 0; duRetCode = CAXM.AxmMotSetAbsRelMode(m_nAxisNumber, Convert.ToUInt32(isRelative)); if (duRetCode != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { MessageBox.Show(String.Format("AxmMotSetAbsRelMode return error[Code:{0:d}]", duRetCode)); return; } //++ 지정한 축을 지정한 거리(또는 위치)/속도/가속도/감속도로 모션구동하고 모션 종료여부와 상관없이 함수를 빠져나옵니다. duRetCode = CAXM.AxmMoveStartPos(m_nAxisNumber, pos * UnitPerMM, Velocity * UnitPerMM, Acceleration * UnitPerMM, Deceleration * UnitPerMM); m_fPosDst = pos; m_eStat = eAxis.eMove; if (duRetCode != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { MessageBox.Show(String.Format("AxmMoveStartPos return error[Code:{0:d}]", duRetCode)); } } } catch (Exception E) { LogFile.LogExceptionErr(E.ToString()); throw E; } }
public static float GetDebugAxis(eAxis _axis) { switch (_axis) { case eAxis.VERTICAL: return((Input.GetKey(KeyCode.UpArrow) ? 1.0f : 0) - (Input.GetKey(KeyCode.DownArrow) ? 1.0f : 0)); case eAxis.HORIZONTAL: return((Input.GetKey(KeyCode.RightArrow) ? 1.0f : 0) - (Input.GetKey(KeyCode.LeftArrow) ? 1.0f : 0)); } return(0f); }
private void setLookAtUpValue(eAxis axis, float value) { switch (axis) { case eAxis.X: m_scene.LookAtUpX = value; break; case eAxis.Y: m_scene.LookAtUpY = value; break; case eAxis.Z: m_scene.LookAtUpZ = value; break; } }
private void setLookAtCenterValue(eAxis axis, float value) { switch (axis) { case eAxis.X: m_scene.LookAtCenterX = value; break; case eAxis.Y: m_scene.LookAtCenterY = value; break; case eAxis.Z: m_scene.LookAtCenterZ = value; break; } }
public void LookAtPositionChanged(eLookAtParam lookAtParam, eAxis axis, float value) { switch (lookAtParam) { case eLookAtParam.Eye: setLookAtEyeValue(axis, value); break; case eLookAtParam.Center: setLookAtCenterValue(axis, value); break; case eLookAtParam.Up: setLookAtUpValue(axis, value); break; } }
public void LightPositionChanged(eAxis axis, float value) { switch (axis) { case eAxis.X: m_scene.LightPositionX = value; break; case eAxis.Y: m_scene.LightPositionY = value; break; case eAxis.Z: m_scene.LightPositionZ = value; break; } }
private bool ValidatePosition(string text, eAxis axis) { int num = Convert.ToInt32(text); if (axis == eAxis.X) { if (num < 0 || num > (CollisionBase.SCREEN_WIDTH - Brick.BRICK_WIDTH)) { return(false); } else if (axis == eAxis.Y) { if (num < 0 || num > (CollisionBase.SCREEN_HEIGHT - Brick.BRICK_HEIGHT)) { return(false); } } } return(true); }
public void MoveV(double fPos, double fPosV, double fV) { if (!m_bIsUseAxis) { return; } //if (WaitReady()) //{ // return; //} while (IsBusy()) { Thread.Sleep(1); } CAXM.AxmMotSetProfileMode(m_nAxisNumber, 3); CAXM.AxmOverrideSetMaxVel(m_nAxisNumber, Velocity * UnitPerMM); m_fPosDst = fPos; CAXM.AxmOverrideVelAtPos(m_nAxisNumber, fPos * UnitPerMM, Velocity * UnitPerMM, Acceleration * UnitPerMM, Deceleration * UnitPerMM, fPosV * UnitPerMM, fV * UnitPerMM, 0); m_eStat = eAxis.eMove; return; }
public void MoveV(double fPos, double fV) { double v, a; if (!m_bIsUseAxis) { return; } //if (WaitReady()) //{ // return; //} while (!IsBusy()) { Thread.Sleep(1); } a = Acceleration * UnitPerMM; if (fV > 0) { v = fV; } else { v = Velocity * UnitPerMM; } m_fPosDst = fPos; CAXM.AxmMoveStartPos(m_nAxisNumber, fPos * UnitPerMM, v, a, a); Thread.Sleep(5); m_eStat = eAxis.eMove; return; }
private void OnEnable() { snap = EditorPrefs.GetBool(SNAP_KEY, false); snapValue = EditorPrefs.GetFloat(SNAP_VALUE_KEY, 1.0f); axis = (eAxis)EditorPrefs.GetInt(AXIS_KEY, (int)eAxis.Y); }
public override void OnInspectorGUI() { EditorGUILayout.HelpBox("Hold Shift and click to append and insert curve points. Backspace to delete points.", MessageType.Info); var spline = target as SplineComponent; var points = serializedObject.FindProperty("points"); for (int i = 0; i < spline.points.Count; i++) { var prop = points.GetArrayElementAtIndex(i); if (hotIndex == i) { prop.vector3Value = EditorGUILayout.Vector3Field($"Point {i}", prop.vector3Value); } } snap = EditorGUILayout.Toggle("Snap", snap); if (snap) { snapValue = EditorGUILayout.FloatField("Snap Value", snapValue); } EditorPrefs.SetBool(SNAP_KEY, snap); EditorPrefs.SetFloat(SNAP_VALUE_KEY, snapValue); var closed = EditorGUILayout.Toggle("Closed", spline.closed); if (spline.closed != closed) { spline.closed = closed; spline.ResetIndex(); } EditorGUILayout.LabelField("Axis"); if (EditorGUILayout.Toggle("X", axis == eAxis.X)) { axis = eAxis.X; } if (EditorGUILayout.Toggle("Y", axis == eAxis.Y)) { axis = eAxis.Y; } if (EditorGUILayout.Toggle("Z", axis == eAxis.Z)) { axis = eAxis.Z; } EditorPrefs.SetInt(AXIS_KEY, (int)axis); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Center around Origin")) { Undo.RecordObject(target, "Center around Origin"); CenterAroundOrigin(spline, spline.points); spline.ResetIndex(); } Rect FlattenArea = EditorGUILayout.BeginHorizontal(); if (GUILayout.Button($"Flatten {axis} Axis")) { Undo.RecordObject(target, $"Flatten {axis} Axis"); Vector3 projectionNormal = GetAxisNormal(); Flatten(spline.points, projectionNormal, spline.transform.position); spline.ResetIndex(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); }
public void Home() { if (m_bIsUseAxis) { SetServoOn(true); uint duRetCode = 0; duRetCode = CAXM.AxmHomeSetVel(m_nAxisNumber, 30 * m_dUnitperMM, 10 * m_dUnitperMM, 5 * m_dUnitperMM, 2 * m_dUnitperMM, 50 * m_dUnitperMM, 50 * m_dUnitperMM); if (duRetCode != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { MessageBox.Show(String.Format("AxmHomeSetVel return error[Code:{0:d}]", duRetCode)); return; } duRetCode = CAXM.AxmHomeSetStart(m_nAxisNumber); if (duRetCode != (uint)AXT_FUNC_RESULT.AXT_RT_SUCCESS) { MessageBox.Show(String.Format("AxmHomeSetStart return error[Code:{0:d}]", duRetCode)); return; } m_eStat = eAxis.eHome; } }