How can I rotate a RigidBody so it is facing the direction it is moving using velocity to move?,Rota

Im new to programming so Im sorry if I am making an obvious mistake (I made all this code by myself so im sorry if its a bit of a mess) but I dont know how to make my rigidbody (player) rotate to match the direction its moving (I used velocity for the movement).

This is my code (I will upload an image):

I will reupload the image as it is not showing up

Welcome to the forum, when seeking help on this forum, instead of posting code in a hard to read image, you can instead post the code directly into your post using Code Tags , as mentioned in the top sticky of the forum.

For your actual problem, you can use something like RotateTowards to rotate your object in steps towards your desired rotation, or you can use LookAt to directly set a target to look at in world space. You can even just directly set the rotation using a Vector3, using Quaternion.Euler.