x


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!!

more ▼

asked Dec 07 '10 at 11:55 AM

min0r gravatar image

min0r
1 1 1 1

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? Move 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

Dec 07 '10 at 12:00 PM Proclyon
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Dec 07 '10 at 12:24 PM

oliver-jones gravatar image

oliver-jones
2.5k 205 225 254

(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Dec 07 '10 at 04:07 PM

min0r gravatar image

min0r
1 1 1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1370
x983
x954

asked: Dec 07 '10 at 11:55 AM

Seen: 1939 times

Last Updated: Dec 07 '10 at 12:12 PM