コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 public static float CalculateAngle2D(Vector2 direction, float angle0 = 0)
 {
     return((Vector2Extend.Tan(direction) * Mathf.Rad2Deg) + angle0);
 }