x


Elicopter Gun Looking at a crossair

Hi guys, i have this question for you: I have an elicopter made by me, this copter has a machine gun in the front that should rotate looking at a crossair that i drawed. This gun have 4 parts:

1."GunA" is the main part of the turret, that should rotate only on the Y axis. 2."GunB" is the second part of the turret, that should rotate only on the X axis. 3."GunC" is the minigun, that is children of the GunB object and should rotate fast on the Z axis. 4.the Muzzle object, where are instantiated bullets.

Now my question is: "How can i rotate this parts only on the X,Y,Z axis and make them looking at the crossair?" Thanks for the reading, bye ;)

more ▼

asked May 06 '12 at 03:06 PM

TheBombix gravatar image

TheBombix
1 7 7

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

2 answers: sort voted first

OK first of all does your crosshair ever move on the screen? If not i would put an empty gameObject right in front of the helicopter. Make it a child to the helicopter then make the gun rotate to look at the empty gameObject with :

transform.LookAt(//put empty gameObject Here);

more ▼

answered May 06 '12 at 03:24 PM

DGArtistsInc gravatar image

DGArtistsInc
269 8 15 19

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

hi DGArtistsInc, i have a Camera that is looking at the copter and the crosshair moves with the camera, so you can look around and shoot where you want.

more ▼

answered May 06 '12 at 04:36 PM

TheBombix gravatar image

TheBombix
1 7 7

is the copter the one moving or is it the camera?

May 06 '12 at 08:31 PM DGArtistsInc
(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:

x446
x39

asked: May 06 '12 at 03:06 PM

Seen: 383 times

Last Updated: May 06 '12 at 08:31 PM