Hi folks!
I'v a function than create a sphere over a plane on the hitpoint of the mouse cursor when I press the left button of the mouse.
I want to make the object growing while the mouse button is pressend, and stop growing when I release the mouse.
I'm trying to do that with Input.GetMouseButtonUp and Down without success :(
Here is my actual code
var bomb : GameObject;
var timeD : float;
var drop : GameObject;
function Update (){
var hit : RaycastHit = new RaycastHit();
var cameraRay : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (cameraRay.origin,cameraRay.direction,hit, 1000)) {
var cursorOn = true;
}
var mouseReleased : boolean = false;
//BOMB DROPPING
if (Input.GetMouseButtonDown(0)) {
drop = Instantiate(bomb, transform.position, Quaternion.identity);
drop.transform.position = hit.point;
Resize();
}
}
function Resize(){
if (!Input.GetMouseButtonUp(0)){
drop.transform.localScale = Vector3(timeD,timeD,timeD);
timeD +=Time.deltaTime;
}
}
Tnx!!