Dunno what I did but it's working now. But now I need help with my logic.
What I'm trying to do:
function Update()
{
if (Input.GetButton("Fire1"))
{
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, hit))
{
transform.position = hit.point;
}
}
}
My FSM:
Listener state - Get button, store it in bool. "bool all true" to send event.
Holding state- Mouse pick, store vector. Set position to stored vector...?
Don't know how to continue my loop so it keeps moving my cube while I hold down my button. I try few ways but they either didn't continue or I got loop limit error. Help please.