/// <summary> /// 위치를 정해주고 값을 더해준다음에 회전값을 적용해주면 위치가 나옵니다. /// </summary> /// <param name="Pos"></param> /// <param name="PlusX"></param> /// <param name="PlusY"></param> /// <param name="Rotation"></param> /// <returns></returns> public static Vector2 DisDirPos(Vector2 Pos, float PlusX, float PlusY, float Rotation, float scale = 1) { var cPos = Vector2.Zero; cPos.X = Pos.X + PlusX; cPos.Y = Pos.Y + PlusY; var Rota = AngleToDegrees(Pos, cPos); var Range = DistanceTwoPoint(Pos, cPos) * scale; Rota = Rota + Rotation; return(MathExt.DirectionFacing(Rota) * Range + Pos); }
public static void KeyAnalgoInputUpdate() { if (Pressed(Keys.Left)) { _virtaulPoint.X -= PointRange(); } if (Pressed(Keys.Down)) { _virtaulPoint.Y += PointRange(); } if (Pressed(Keys.Right)) { _virtaulPoint.X += PointRange(); } if (Pressed(Keys.Up)) { _virtaulPoint.Y -= PointRange(); } var m_VitualMovingPoint = _virtaulPoint; if (MathExt.DistanceTwoPoint(Vector2.Zero, _virtaulPoint) > 0.3f) { if (m_VitualMovingPoint.X != 0) { _virtaulPoint.X -= _virtaulPoint.X * TimeExt.ElapsedGameTime * 30; } if (m_VitualMovingPoint.Y != 0) { _virtaulPoint.Y -= _virtaulPoint.Y * TimeExt.ElapsedGameTime * 30; } } KeyBoardAnalrog = MathExt.DirectionFacing(MathExt.Angle(m_VitualMovingPoint)); if (!(Pressed(Keys.Left) || Pressed(Keys.Down) || Pressed(Keys.Right) || Pressed(Keys.Up))) { KeyBoardAnalrog = Vector2.Zero; } }