x


Robot turrets move and fire

Hey I am making a game where you are a robot, I want the legs to move the body while the top follows the mouse and fires bullets. I have the moving and rotating down all I need is help with the bullets flying from the turret, instead of the legs, I put script on the turrets and made them fire but its still coming from the legs.

more ▼

asked Apr 20 '10 at 06:49 PM

DTJ Productions gravatar image

DTJ Productions
57 19 20 25

Post some code or something

Apr 20 '10 at 07:32 PM spinaljack
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

It sounds like you simply need to either raise the position of the bullet's starting position, or - if your turrets are a separate gameObject, use the turret's position instead of the legs. (Presumably your script is on the "legs" gameobject, and the rotating turret is a child object of the legs?...).

Eg - Instead of:

var bullet = Instantiate( bulletPrefab, transform.position, turret.rotation);

You could either have:

var bullet = Instantiate( bulletPrefab, turret.position, turret.rotation);

Or:

// bullets start 2 units higher:
var bulletPos = transform.position + Vector3.up * 2; 
var bullet = Instantiate( bulletPrefab, bulletPos, turret.rotation);
more ▼

answered Apr 21 '10 at 10:01 AM

duck gravatar image

duck ♦♦
41k 92 148 415

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

does it have a title screen yet?

more ▼

answered Apr 21 '10 at 12:00 PM

Not showing my name gravatar image

Not showing my name
107 8 9 19

Why do you need to know? How does that help?

Apr 23 '10 at 01:58 AM DTJ Productions
(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:

x5078
x2087
x172
x29

asked: Apr 20 '10 at 06:49 PM

Seen: 1707 times

Last Updated: Apr 20 '10 at 06:49 PM