public static double AngleInDegrees(Vec2 position) { double angle = System.Math.Atan2(position.TransformY, position.TransformX); angle = angle < 0 ? Math.Angles.RadiantsToDegree(angle + System.Math.PI) : Math.Angles.RadiantsToDegree(angle); return angle; }
public static Vec2 Add(this Vec2 me, Vec2 position) { me.TransformX = me.TransformX + position.TransformX; me.TransformY = me.TransformY + position.TransformY; return me; }
public static Vec2 Subtract(this Vec2 me, Vec2 position) { me.TransformX = me.TransformX - position.TransformX; me.TransformY = me.TransformY - position.TransformY; return me; }
public Mouse(Vec2 pos) { this.MouseId = MouseIds++; Points = 1; this.Scale = new Vec2(1, 1); this.Position = pos; }
public Vec2 Lerp(Vec2 start, Vec2 destination, double t) { Vec2 point = new Vec2(); point.TransformX = (1 - t) * start.TransformX + t * destination.TransformX; point.TransformY = (1 - t) * start.TransformY + t * destination.TransformY; return point; }
public static double AngleInRadiants(Vec2 position) { double angle = System.Math.Atan2(position.TransformY, position.TransformX); return angle; }
public void SetVelocity(Vec2 velocity) { Velocity = velocity; RotateToPoint(velocity); }
public void RotateToPoint(Vec2 point) { Vec2 direction = point.Subtract(Position); Rotation = Angles.AngleInDegrees(direction); }
public void Move(Vec2 pos) { Position.TransformX = pos.TransformX; Position.TransformY = pos.TransformY; }