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 ;)
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);
answered May 06 '12 at 03:24 PM