needle movement

For every 10 point needle inside a meter should move a to move needle inside pressure gauge or some moving needle from 50,51,52— to 10 in clock wise direction inside the clock for every 10 point needle should move one point.

Your skala range, devided by the amount of steps, multiplied by your input/10.



I assume you have number around the gauge at even intervals. I assume you only want the needle to move if the number is climbed past a 10 value. Below is a starter script. fDegreesPerPosition is the angle between two number on the game. fValue is the value you want to display. This code assumes a camera at -Z looking towards +z.

public class AngleRotationInIncrements : MonoBehaviour {
	public float fValue = 0.0f;
	public float fValuePerPosition = 10.0f;
	public float fDegreesPerPosition = 30.0f; // Twelve positions
	private Vector3 v3StartRot;

	void Start () {
		v3StartRot = transform.localEulerAngles;
	void Update () {
		float fT = Mathf.Floor (fValue / fValuePerPosition) * fDegreesPerPosition;
		transform.localRotation = Quaternion.Euler (0.0f, 0.0f, v3StartRot.z - fT);