# Instead of rotating 180, I would like to rotate directly away from an object for a wall jump, how do I get my rotation compared to objects normal?

This is what I have currently. My character will do a 180 turn, then apply force, results in my character jumping directly away from my current rotation when I hit the wall. I want to make my character jump directly backwards from where the fall is facing regardless of the angle I hit it at. I’ve tried getting the normal, but so far have had no luck. I’m not sure if I’m applying the normal incorrectly or if there is another way to go about it.

``````public bool TryWallJump()
{
RaycastHit hit;
if (Physics.Raycast (transform.position, transform.forward, out hit, wallJumpDist))
{
if (!hit.transform.collider.isTrigger)
{
if (hit.transform.tag != "Player" && (Mathf.Abs (rigidbody.velocity.x)) > neededWallJumpVelocity)
{
if (throwable.heldObj != null) {
throwable.heldObj.SetActive (false);
transform.RotateAround (transform.position, transform.up, 180f);
//Quaternion q = Quaternion.FromToRotation (transform.up, hit.normal);
//transform.rotation = q * transform.rotation;
Jump (wallJumpForce);
throwable.heldObj.SetActive (true);
return true;
} else
{
transform.RotateAround (transform.position, transform.up, 180f);
Jump (wallJumpForce);
return true;
}
} else if (TryDoubleJump())
{
return false;
}
}
}
return false;
}
``````

`````` transform.rotation = Quaternion.LookRotation(hit.normal);
``````

?

What my solution ended up being was this. I had to set my current vel to 0 to avoid screwy things. Thank you!

``````if (Physics.Raycast (transform.position, transform.forward, out hit, wallJumpDist))
{
transform.rotation = Quaternion.LookRotation(hit.normal);
GetComponent<Rigidbody>().velocity = new Vector3(0,0,0);
Jump (wallJumpForce);
}
``````