# How to wall-walk?

I have tried to ask several times but I still didn’t mange to make it work. So I want to make my player walk on walls just like it would on the ground. Therefore I need to change the gravity and rotate the camera, that worked fine. But then I also need the player to rotate based on the hit.normal of the ground and move him based on the input from the joystick and make that align with the surface (or perpendicular to the hit.normal) see image. This is where I can stuck every time. I would really appreciate it if u could correct my code so that it would work. I will give 20 points away if it worked :).
1.I’am using a Rigidbody
2. I’am using a joystick that returns a vector form -1 to 1 like (3, 0f, -8).

`````` private void Update()
{
h = Joystick.Horizontal;
v = Joystick.Vertical;
movement = (transform.forward * v) + (transform.right * h);
//or movement.Set(h, 0f, v)
Debug.Log(movement);
}
private void FixedUpdate()
{
Physics.Raycast(transform.position, -(transform.up), out hit, RayLengh)
transform.up = hit.normal;
transform.rotation = Quaternion.LookRotation(movement, transform.up);
playerRig.MovePosition(transform.position + movement);
}
``````

Afaik, is not a good idea to ever set the Up of a transform.

I wrote this code just now, but did not test. Add me on Discord: Laur#6047 . I will get it done in the afternoon and help you.

``````		public Vector3 normal = Vector3.up;

private void FixedUpdate()
{
if (Physics.Raycast(transform.position, -(transform.up), out hit, 100))
{
transform.position = hit.point;
normal = hit.normal;
}
}

private void Update()
{
transform.rotation = Quaternion.LookRotation(movement.normalized, normal);
}
``````

You can use Custom Gravitations Kit for that, and walk everywhere, even on ceiling =) Custom Gravitations Kit | Physics | Unity Asset Store