Rigidbody2D Axis relative to local object rotation?

Hey there, I would really appreciate help. I need help to have my objects rigidbody2d axis rotate when my object rotates due to the terrain, allowing me to run up walls.

Here is the code I have so far(whole character control script): MOVEMENT SCRIPT

Here is a picture of the goal I am trying to achieve:

This is the kind of thing I’d need to play with to figure out a working solution. You have a bunch of things here that can interact to make a solution difficult. Addressing the specific question, I’d start by raycasting slightly ahead of the ball. You would use the -transform.up as the direction, and the transform.position + rigidbody2D.velocity.normalized * offset as the position of the raycast. Given a valid hit, here is a bit of untested code that does both the rotation and the change in velocity.

 var newDir = Vector3.Cross(hit.normal, Vector3.forward); 
 var q = Quaternion.FromToRotation(rigidbody2D.velocity, newDir);
 transform.rotation = q * transform.rotation;
 rigidbody2D.velocity = newDir * rigidbody2D.velocity.magnitude;

You may have to reverse the parameters in the Vector3.Cross().