Rotate using pivot point

I’m using the following code for rotate my surface controls:

using UnityEngine;
using System.Collections;

public class pivotTest : MonoBehaviour {

	Transform C_elevator;
	
	// Use this for initialization
	void Start () 
    {
		C_elevator = transform.FindChild("C_elevator");
	}
	
	void Update () 
	{
		float vertical = Input.GetAxis("Vertical") * Time.deltaTime * 10;
        C_elevator.RotateAround(C_elevator.position, C_elevator.right, vertical);
	}
}

alt text

The problem is while I’m not changing my axis, surfaces should return to the idle position. I assume I should change my object’s rotation…

Can you help me, please?

Assuming that a rotation of (0,0,0) puts the elevator back into position, you can do the following (untested):

 void Update () 
    {
       float vertical = Input.GetAxis("Vertical") * Time.deltaTime * 10;
       if (vertical > 0.01f)
           C_elevator.RotateAround(C_elevator.position, C_elevator.right, vertical);
       else
           C-elevator.localRotation = Quaternion.Slerp(C-elevator.localRotation, Quaternion.identity, Time.deltaTime * return_speed);
    }

‘return_speed’ is a variable you define that controls how fast the elevator will return. You can replace Quaternion.Slerp() with Quaternion.RotateTowards() if you don’t want easing at the end of the movement.