x


Bullet Script Help

I have a script which is from the fps tutorial on the unity website which allows you to shoot a bullet prefab, but what it dosent do is spawn my bullet prefab at the end of my gun, please can anyone help? For some reason I cant get the script to look correct on this question even with the code sample button so here is the link. http://download.unity3d.com/support/resources/files/FPSTutorial1.pdf

more ▼

asked Sep 17, 2011 at 09:26 PM

Dreave gravatar image

Dreave
137 255 179 179

Where does it spawn from instead?

Sep 17, 2011 at 10:27 PM Waz

in the centre of my screen

Sep 18, 2011 at 06:59 PM Dreave
(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

Make a small cube at the end of your gun and turn off the "Mesh Collider" component to make it invisible. Attach the fire script to that cube.

more ▼

answered Sep 19, 2011 at 04:37 AM

Clunk gravatar image

Clunk
241 3 2 4

This is a round-about way of making an Empty, which can be made from the GameObject menu.

Sep 19, 2011 at 06:19 AM Waz

it spawns at the end of my gun now but it go downwards instead of firing straight please help.

Sep 19, 2011 at 06:42 AM Dreave

dosent matter ive fixed it

Sep 19, 2011 at 06:55 AM Dreave
(comments are locked)
10|3000 characters needed characters left

oh!!! I think the axis-z of your spawn point is facing down. That's why the bullet is going downward. So try to rotate the spawnpoint to make the z-axis facing forward!

more ▼

answered Sep 19, 2011 at 06:55 AM

henry96 gravatar image

henry96
657 48 38 44

works now thanks

Sep 19, 2011 at 03:35 PM Dreave
(comments are locked)
10|3000 characters needed characters left

Ye, I was gonna say, rotate it lol.

more ▼

answered Sep 19, 2011 at 04:26 PM

Clunk gravatar image

Clunk
241 3 2 4

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

x8731
x6356
x630
x439

asked: Sep 17, 2011 at 09:26 PM

Seen: 2857 times

Last Updated: Sep 19, 2011 at 04:26 PM