x


How to position objects with mouse?

Hello everyone. I searched for a similar question but did not find one, sorry if this is a repeat.

I am working on a project to create a top down game where you can click on a GUI button to place objects (such as houses, benches, tables) into a scene. My problem is I cannot figure out how to move/rotate the object once it has been instantiated. I was thinking maybe using the left mouse button to move it and right mouse button to rotate it around the y-axis.

If you could help me with a script or just point me in the right direction I would be very thankful, and would like to say Thank You in advance.

more ▼

asked Jun 17 '10 at 04:28 AM

Dan 3 gravatar image

Dan 3
3 1 1 2

Why not use a keyboard button to rotate? Much easier.

Jun 17 '10 at 10:47 AM spinaljack
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Find the DragObject script from "Unify forums". Than add things like if (Input.GetKey (KeyCode.UpArrow)) MoveUp(); if (Input.GetKey (KeyCode.DownArrow)) MoveDown(); if (Input.GetKey (KeyCode.RightArrow))TurnRight(); or with mouse buttons

more ▼

answered Jun 17 '10 at 03:35 PM

towerer gravatar image

towerer
108 3 4 10

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

I'd recommend doing something more obvious. Like you have the concept of a "selected" item (maybe it's highlighted somehow). And on that selected item you have 3D buttons you can click on to cause the object to rotate one way or another.

more ▼

answered Jun 17 '10 at 12:30 PM

Tetrad gravatar image

Tetrad
7.2k 27 37 89

(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:

x5072
x2163
x983
x885
x69

asked: Jun 17 '10 at 04:28 AM

Seen: 1623 times

Last Updated: Jun 17 '10 at 04:28 AM