coding in c#

Hi,
I have this maze/marble game where you want to get the marble to the end of the maze by tilting the board. The game is meant for a touch screen but first i tired the concept using keyboard inputs. I used java script and succeeded using these two lines:

transform.rotation.x = transform.rotation.x+0.01*-Input.GetAxis(“Vertical”)
transform.rotation.z = transform.rotation.z+0.01*Input.GetAxis(“Horizontal”)

my problem is that i need to translate this code to c# and I read that in c# the rotation function is like a struct and you have to change all the values not one independently. i’m a little confused as how to do that… any help would be greatly appreciated :slight_smile:

i’d use transform.Rotate()

thanks, i actually played around with that function and it worked!

that transform.Rotate helped a lot but now i’m actually trying to use that function with the touch data that i’m getting from the touchscreen but every time i touch the maze it just keeps rotating without stopping…

i have a touch struct that contains the components of the touch and thats what i’m using for the x and y coordinates.

void FixedUpdate() {

newTouch = ProcessData();

float moveForward = rotateSpeed * Time.deltaTime * newTouch.yPos;
float moveLeft = rotateSpeed * Time.deltaTime * newTouch.xPos;

transform.Rotate(Vector3.forward * moveForward);
transform.Rotate(Vector3.right * moveLeft);

}

is it not working because i need to add limits so it won’t be able to rotate over a certain point or is more of a logical error?

thanks for the help :slight_smile: