- Home /
How to Move a Cube
Hi
I just want to know how i can move a cube with mouse. can somebody help me ?
i just want that after i press on a button there is created a cube which hangs on my cursor and after clicking the cube is placed on a plane. I need the script as c# script.
thanx!!
What kind of movement are you trying to do ? How do you want the mouse event registered? Is it drop and drag? Click event = hold and drop on event aswell? $$anonymous$$ove by auto follow? Is it a 2D or 3D environement? Here's some usefull links for mouse and movement in advance. http://unity3d.com/support/documentation/ScriptReference/Input-mousePosition.html & http://unity3d.com/support/documentation/ScriptReference/Transform-position.html
Answer by oliver-jones · Dec 07, 2010 at 12:24 PM
I'm not sure what Unity you have, but if you do a search in your Project Window for 'DragRigidbody'. Simply add this to your cube (make sure it as a rigidbody attached to it).
Should be a start.
Answer by min0r · Dec 07, 2010 at 04:07 PM
I'm trying to build a Tower Defense. and it should normaly work like one, im Pressing the "tower" button, and after it im alowed to place it on my terrain ( its just a plane in this case)
http://www.bilder-hochladen.net/files/3bpq-b-jpg.html
here a picture, of it.
Answer by kjelle392 · Aug 16, 2014 at 10:43 AM
Have a look at this Youtube-video: https://www.youtube.com/watch?v=OuqThz4Zc9c