i have been trying to build Tetris, and i have almost everything worked out but i cannot get the piece to rotate in position; whenever i tried to rotate it, it rotated as if around another object… i don’t understand why this is happening. could it be because my object is a prefab made out of multiple objects? here is the code for the movement of the blocks(i have not added the downward momentum yet).
#pragma strict
public var falling : boolean;
function Start()
{
falling = true;
}
function Update()
{
if(this.falling == true)
{
if(Input.GetKeyDown(KeyCode.LeftArrow))
{
this.transform.position.x -= 1;
}
if(Input.GetKeyDown(KeyCode.RightArrow))
{
this.transform.position.x += 1;
}
if(Input.GetKeyDown(KeyCode.UpArrow))
{
this.transform.rotation.z += 90;
}
if(Input.GetKeyDown(KeyCode.DownArrow))
{
this.transform.position.y -= 1;
}
}
}