- Home /
Why can't i modify object.trasform.position more than once?
I am trying to move the faces of a rubik's cube and i've made a function that rotates a face once. However i can't seem to be able to use the function more than once.
void moveFaceCW()
{
for (int i=1; i<10; i++)
{
if (i != 5)
{
cub [v [movedLayer [i]]].transform.position = rotCW [movedLayer [i]];
Debug.Log (movedLayer [i]);
cub [v [movedLayer [i]]].transform.rotation = Quaternion.Euler (0.0f, 0.0f, -90);
}
}
}
movedLayer[i] holds the number of the piece (little cube) on the face; v[i] holds the number of the little cube on the entire cube as it is rotated; rotCW[] is a Vector3 array that holds the position where the little cube goes due to a CW turn. Do you guys have any ideea why it won't let me use this function more then once? ( the other code executes fine. Is like it skips the function call)
maybe is worth mentioning that the function call is in FixedUpdate() in an if statement: if(Input.GetButtonDown("button");
Your answer
Follow this Question
Related Questions
transform.position any suggestions? 2 Answers
transform.position.x brings up error 1 Answer
Linecast blocked by colliders not actually in the way? 0 Answers
Newbie question 2d positioning and moving 2 Answers
Object Boundaries C# help please 1 Answer