Using transform in a static void

I have this code

using UnityEngine;
using System.Collections;

public class openRedDoor : MonoBehaviour {

public static openRedDoor Instance;
public static Rigidbody rb;

// Use this for initialization
void Start () {
	rb = GetComponent<Rigidbody>();
}

// Update is called once per frame
void Update () {

}

public static void opendoor()
{
	Debug.Log("This function was called from a script attached to switch");
	float FinalHeight = 10f;
	
	Vector3 FinalPosition = new Vector3 (transform.position.x, FinalHeight, transform.position.z);
	transform.position = Vector3.Lerp(transform.position, FinalPosition, Time.deltaTime);
}
}

which is called by a script connected to a switch gameobject. When the switch gameobject touches the player, opendoor() in this script is called. I want the above code to open a door with the function opendoor().

When the function is run, I get the error Assets/scripts/openRedDoor.cs(26,54): error CS0120: An object reference is required to access non-static member UnityEngine.Component.transform

I know that this is somehow connected to my script being static, and therefor I need to access the transform function differently.

How can I make this door move up, by calling the function opendoor()? How can I use transform without getting an error?

Sorry, I have been using unity for about 3 days, so I am completely new to this. I really appreciate your help.

this is not a unity error but more a c# error.

you are using a non-static variable (transform) inside a static function without having a reference to which object it is inside that function. that’s not allowed. (no, you cannot use the built in ‘this.transform’ - because it is a static function).

Actually, you seem to be using the static keyword way too much here. Looking at your code, it really shouldn’t be in it anywhere at all.