hey,
i want to play animation when i click the object like leaver which power on the machine.
similar i did here when i click the leaver it plays the animation of leaver and after that machine it works fine.
my prob is i also have texture that i want to animate when i click on leaver
i have script which can animate texture but it works on object not on fbx.
i tried this script. tell me where am i doing wrong ??
var wasClicked: boolean = false;
var scrollSpeed : float = 0.5;
function OnMouseUp() {
wasClicked = true; // turns on button.
}
var target : GameObject;
var target_2 : GameObject;
var fabric_1 : GameObject;
var fabric_2 : GameObject;
function OnMouseDown(){
Debug.Log("Object clicked");
target = GameObject.Find("Leaver");
target.animation.Play();
yield WaitForSeconds (1);
target_2 = GameObject.Find("machine_5");
target_2.animation.Play();
fabric_1 = GameObject.Find("Object001");
var offset : float = Time.time * scrollSpeed;
fabric_1.renderer.material.mainTextureOffset = Vector2 (offset, 0);
fabric_2 = GameObject.Find("Object004");
offset = Time.time * scrollSpeed;
fabric_2.renderer.material.mainTextureOffset = Vector2 (offset, 0);
}
regards
thanx