Transform GameObject Script

Hi,

I am a newbie with Unity, and I am testing it’s scripting ability now. May someone help me out. I would like to create a scene where an object will move and rotate to a certain direction in a specified distance with a mouse click? May someone provides me some sample codes?

And I have a script to trigger an event. It now happens whenever I move my mouse. How can I control it to happen only while my mouse button is down?

Thank you very much!!

try this example: unifycommunity.com - unifycommunity Resources and Information. :wink:

Thanks Jaxas,

How can I limit the move only happens while I am pressing the mouse down. In other words, if I don’t press the mouse down and move the mouse, there should have nothing happen. How can I do that?

if(Input.GetMouseButton(0))
{
  //add here your moving
}