Rotate Raycast with a Button smootly,is this possible?

Im making an active ragdoll character which requires a direction to walk in,i want to cast a raycast from his body and rotate it with a button and then add impulse on the legs in that direction.Any help would be greatly appreciated!Thanks!