Hi,
I would like to ask you for help! I need to stop my script when "myObject" rotation reaches 0 in X,Y and Z axis ( or it'll be close to that value, e.g. +-3 degrees ). Console shows me "Cannot convert 'void' to 'UnityEngine.Transform'.". I know what it means ;) , but I have no idea how to make my script working. Thanks a LOT and sorry for my English! :)
JS
#pragma strict
private var h : float;
private var v : float;
var horozontalSpeed : float = 0.5;
var verticalSpeed : float = 0.5;
var myObject : GameObject;
function Update()
{
if (Input.touchCount == 1)
{
var touch : Touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved)
{
h = horozontalSpeed * touch.deltaPosition.x ;
transform.Rotate( 0, h, 0 );
v = verticalSpeed * touch.deltaPosition.y ;
transform.Rotate( -v, 0, 0 );
}
}
var myObjectPos : Transform = transform.Rotate(0, 0, 0);
if (myObjectPos && transform.Rotate != myObjectPos.Rotate)
{
GetComponent(MoveBackRot).enabled = false;
}
}
↧