Directional Velocity

Hello, I’m creating a game in which I am working on my own physics. I am using a parabola to get my character to follow that arc and jump. I would like to reset the characters velocity about every 10th of a second to the calculated point in the parabola. So all I need is some function or ability in unity to make set a velocity to point directly at a specific spot. Is there a inbuilt function like this in unity? There should be, i have used it in many other game engines, but I cant seem to find it in the documentation.

For instance:

x = player.transform.position.x + 0.1f;
float y = -(x - Ix - 1.414f) * (x - Ix - 1.414f) + 2f;

playerRigidbody.Velocity = velocity with magnitude from current position to (x,y) 

Then it will reset every time the function is repeated. I could calculate what the velocity should be i guess, but i thought there might be an easier way.

Thanks For your help

Yes there is. I believe what your talking about is the game objets Transform (direction).

There is, forward, right, and up, you can get the flip side of these by making these variables negative, so -right becomes left, -forward becomes backward, and -up becomes down.

You can access them by 2 ways:

  1. The objects transform directions:
    playerRigidbody.Velocity = playerRigidbody.transform.forward;

  2. The game world transform direction:
    playerRigidbody.Velocity = Vector3.forward;

Rigidbody also has velocity.magnitude, and I believe its velocity.magnitude.normalized to get the normalized or non-normalized version of the current magnitude of your object, as well as a squard version of the magnitude, which I dont remember off the top of my head since I dont think iv ever used it myself.

Hope this helped.

Thanks for the answer!