public void PushBall() { int rotation = _gameManager.CurrentLevel.Random.Next(0, 6); TV_2DVECTOR impulse = new TV_2DVECTOR(50f, 50f); impulse = RotateVector(impulse, rotation); _gameManager.TvPhysics.AddImpulse(_physicsBody, new TV_3DVECTOR(impulse.x, 0, impulse.y)); }
public TV_2DVECTOR RotateVector(TV_2DVECTOR vector, float radians) { TV_2DVECTOR outVector = new TV_2DVECTOR { x = vector.x * (float)System.Math.Cos(radians) - vector.y * (float)System.Math.Sin(radians), y = vector.y * (float)System.Math.Cos(radians) + vector.x * (float)System.Math.Sin(radians) }; return(outVector); }
public static Vector2 ToVector2(this TV_2DVECTOR vector) { return(new Vector2(vector.x, vector.y)); }