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/FPS_Tutorial_1.pdf
Where does it spawn from instead?
in the centre of my screen
Answer by Clunk
Sep 19, 2011 at 04:37 AM
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.
This is a round-about way of making an Empty, which can be made from the GameObject menu.
it spawns at the end of my gun now but it go downwards instead of firing straight please help.
dosent matter ive fixed it
Answer by henry96
Sep 19, 2011 at 06:55 AM
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!
works now thanks
Answer by Clunk
Sep 19, 2011 at 04:26 PM
Ye, I was gonna say, rotate it lol.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
5 People are following this question.
A node in a childnode?
Gun Muzzle Flash
Wait for reload to finish?
Timing Between each Gun Shot
The name 'Joystick' does not denote a valid type ('not found')