how to add force to a moving object without altering direction of travel,How does one add speed to a moving object

body = GetComponent();


          body.AddForce(Vector2.up * speed);
          body.AddForce(Vector2.right * speed);


I am making a breakout copy - what you see above is attached to the ball/puck :
I made it like this because i need the ball to travel at 45 degrees. - if anyone knows how to shoot the ball at a 45 degree angle would be useful too xx

I need to know how to add some speed to the rigid body without having to alter the way the body will travel.

ive been looking at similar examples but don’t really understand how to implement this behaviour
pls help been here for 2 days now with this,

public float pushForce = 1;

// Cache stuff

private Vector3 lastPos;

private RigidBody rbd;

private void Awake()

this.rbd = this.rigidBody;   // Cache


private void ApplyPush()



private IEnumerator DoApplyPush()

// Get the position then move to the next frame

this.lastPos = this.rbd.position;

yield return null;  // continue next frame

// Get the motion vector which is a vector from last frame to this frame.

Vector3 motionVect = this.lastPos - this.rbd.position;  // Backward?

// ... Do stuff ...

// No idea if this will work, just based on docs

this.rbd.AddForce(motionVect.normalize * this.pushForce);



Well if the force goes another way simply just switch 2 vectors

Well you need to give exact same vector if you want not to change the direction

Try something like this:

public GameObject yourObject;

The first line is the object itself, and it must have a Rigidbody or Rigidbody2D component, so that you can do physics stuff. It then gets the velocity of the object, which is a vector, and applies that vector to the object as a force. Simplified, it pushes the object by the object’s speed. You can modify the second line to something like this:

(whatever).AddForce(yourObject.GetComponent<Rigidbody>().velocity * 0.5);

It’ll push the object by half its speed. I recommend reading the docs on AddForce() and the different vectors you can get from Rigidbody, they were very helpful to me.