How to smash a ball? 2D (C#)

Hello, sorry I’m new in programming. But I would like to make a simple game, baseball game-like. I would like to smash the ball (2D) to make it fly. But my bat is not even smashing the ball, it’s just pushing it away :frowning:
pleaaase help. Any help is really appreciated :smiley: Thank you in advance :D.

	public float RotSpeed = 5.0f;
	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
		if(Input.GetKey(KeyCode.D)) {
			transform.Rotate(0, 0, RotSpeed * -1); 
		if(Input.GetKey(KeyCode.A)) {
			transform.Rotate(0, 0, RotSpeed);

In my personal opinion, anything with physics, especially starting out, can be advanced. Look into RigidBody2d, and Collider2D (Im not sure if you are using a BoxCollider2d, or a SphereCollider2D or another type of Collider2d).

The reason I say to look into these, is because it can be hard to explain the entire process to fixing your problem especially without actually seeing exactly how your physics are reacting, the code doesnt help very much at all, because it only shows how your rotating an object, that doesnt even seem like it may have any reference to any physics.

RigidBodies contain weight, as well as gravity settings, the project itself may even have settings, and you can add stuff like physics materials which can do some pretty interesting stuff (in my opinion), like have whatever object bounce off of another, or slide off another, or react like it would if it hit wood or ice, or you can even set up your own. It can get complicated, cause Physics in general, can get complicated. So for sure look into those 2 elements.

For starting out, you may want to consider maybe trying a more simplistic project, or if you are really passionate about this one, maybe look on YouTube for some tutorials on Physics and how they work in Unity, and try to replicate them, to get a understanding of it.