changing player angles with controller

using UnityEngine;
using System.Collections;
 
public class angleTriggerUP : MonoBehaviour {
 
    public GameObject player;
 
    void OnTriggerStay2D (Collider2D other) {
      if(other.gameObject.tag == "Player")
        {
            player.transform.rotation = Quaternion.Euler(0,0,45);
            //print ("Up The Mountain");
        }
 
    }
}
 
 
 
using UnityEngine;
using System.Collections;
 
public class angleTriggerLevel : MonoBehaviour {
 
    public GameObject player;
   
    void OnTriggerStay2D (Collider2D other) {
        if(other.gameObject.tag == "Player")
        {
            player.transform.rotation = Quaternion.Euler(0,0,0);
            //print ("On Level Ground");
        }   
    }
}
 
 
 
using UnityEngine;
using System.Collections;
 
public class angleTriggerDown : MonoBehaviour {
 
    public GameObject player;
   
    void OnTriggerStay2D (Collider2D other) {
        if(other.gameObject.tag == "Player")
        {
            player.transform.rotation = Quaternion.Euler(0,0,-45);
            //print ("Down The Mountain");
        }
 
    }
}

I’m using box coliders to change the angle of a dune buggy…is there a better way of doing this for 2D?

no body???

What you are trying to do is not very clear, maybe explain what you are trying to accomplish and we will be able to help?

I trying to keep the car level to the ground its on in 2D or going up a hill or down a hill

So trying to make the car following the slope of the ground beneath it?

If you use circle colliders for the wheels and have rigidbodies on all parts of your car it will automatically follow physics, and follow the slope of the terrain

Won’t work using fixed angles, so buggy can’t flip over…I think I’ll stick to the box collider triggers

It definitly can if it has a physical reason to, the physics objects can rotate the full 360, so yes it can.
In the end your project your decisions though, so good luck