marble game board

var rightSpeed = -0.01;
var leftSpeed = 0.01; // Same as rightSpeed but a negative
var forwardSpeed = -0.01;
var backwardSpeed = 0.01;
// from +Z perspective
function Update()
{
if(Input.GetKey(“left”))
{
// transform.RotateAround(transfor.eulerAngles = Vector3(-10,0,0), leftSpeed);
transform.RotateAround(transform.forward, leftSpeed);
// transform.eulerAngles = Vector3(0,0,6)

I’ve been making a marble game board, and I’m trying to make the board only rotate so far, so that I don’t have the marble fall off the board, I’ve tried looking up ways to limit rotation, but none what I have found seems to work for me.

I was thinking of trying to set a euler angle as a maximum value of rotation, but I can’t seem to get that to work.

I like how this line of code works;
transform.RotateAround(transform.forward, leftSpeed);
but I’d like it to not rotate the board 360 I’d like it to rotate till its at 7 degrees and stop.
I have simply included the part of the code for the “left key”, but I have all four, up, down, left, right; keys working.

If possible, I’d like to use a Euler angle as a limit, and rotate smoothly to that limit.

I just started to find using things like this; http://code.google.com/p/see-saw-unity/source/browse/trunk/see-saw-unity/Assets/Standard%20Assets%20(Mobile)/Scripts/RotationConstraint.js?r=2&spec=svn2

this is almost what I need, but I need it to be on geometry only, and not need the use of the iPhone.
and I need the constrain more setable so i can choose how far the object is going to rotate.

its fine if its a seperate script to limit the roation, I just need something to set a constraint on how far the game board rotates.

You were right about testing euler angles (use Abs() for that). you can acces those angles with transform.rotation.eulerAngles.x/y/z. Note that they are read only.

Thank you for all the help. I found a script that works well for me.

var speed: float = 10; //rotation speed

function Update()
{   
    if(Input.GetKey("right"))
    {
     	transform.Rotate(0, 0, -/+speed * Time.deltaTime);
    }
}