I have a 2D block falling (like tetris) and is rotating when click on this. I would to disabled this action (rotation when click) when the blocks do collision with the ground. I try this but I don´t know why but it isn´t work. The rotation work but it doesn´t stop
This is the script to stop the rotation:
var rotar = rotaralclick;
function OnTriggerEnter(Otro : Collider)
{
if (Otro.gameObject.name == "suelo")
{
GetComponent.rotar.enabled=false;
}
}
and this is the script of the rotation, in the same prefab
function Update ()
{
if(Input.GetMouseButtonDown(0))
transform.Rotate(0, 0, -90);
}
Thank ownerfate, the botton script work perfectly, but the second script didn´t work well, I change ontriggerenter and I wrote Oncollisionenter2D and it´s fine. Probably it was only a problem of my scene.
– DaniDiaz