public static void SetVelocity(this Rigidbody2D @this, Vector2 newValue, ChangeTypeEnum changeTypeTransform, Axis2DCombined axisCombined = Axis2DCombined.XY) { if (@this) { Vector3 velocity = @this.velocity; @this.velocity = Vector2Extend.ChangeVector(velocity, newValue, changeTypeTransform, axisCombined); } }
public static void SetYVelocity(this Rigidbody2D @this, float yValue, ChangeTypeEnum changeTypeTransform, Vector2 range = default) { if (@this) { Vector3 velocity = @this.velocity; velocity = Vector2Extend.ChangeVector(velocity, Axis2DEnum.Y, yValue, changeTypeTransform, range); @this.velocity = velocity; } }
public static float CalculateAngle2D(Vector2 direction, float angle0 = 0) { return((Vector2Extend.Tan(direction) * Mathf.Rad2Deg) + angle0); }