Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by hugemaggot · Dec 05, 2010 at 05:36 PM · shootingbullet

shooting more than 1 bullet

how do i go about shooting more than 1 bullet when i press the fire button, for example like call of duty.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rennat · Dec 05, 2010 at 05:59 PM 0
Share

Like a shotgun?

avatar image oliver-jones · Dec 05, 2010 at 07:00 PM 0
Share

Please be more specific in your posts - do you mean like a L$$anonymous$$G (so on bullet after another) or like Rennat asked, a shotgun? (like a spray)?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by JesusChristChangedMe · Dec 05, 2010 at 08:17 PM

this will tell your game when the left button is held down to keep fireing a bulletprefab. make sure the prefab has a rigidbody and make sure the gun your shooting from has a spawnpoint and it is named exactly "Spawnpoint".you can make a spawnpoint just by making a sphere and making sure the sphere is exactly where you want your bullet to appear. So it would probably be wise to put it in front and close to the barrel of the gun. Also make sure it is a child of the gun. To make it a child of the gun just drag the spawn point in the hierarchy onto the gun in the hierarchy. theres a couple of things that need to be done outside of the script for it to work. make sure your spawnpoint is unchecked mesh renderer and doesnt have a collider.

var bullet : Transform;
function Update()
{
if(Input.GetButton("Fire1"))
{
var bullet = Instantiate(bulletPrefab ,transform.Find("Spawnpoint").transform.position ,Quaternion.identity);
  bullet.gameObject.tag = "enemyProjectile";
  bullet.rigidbody.AddForce(transform.forward * 2000);
}
}

Hope this helps!

Comment
Add comment · Show 10 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jesus_Freak · Dec 05, 2010 at 11:15 PM 0
Share

i'm sure UnityScripter meant left $$anonymous$$OUSE button. not left arrow button. just for clarity. Fire1 = left mouse button unless changed in the Input $$anonymous$$anager.

avatar image JesusChristChangedMe · Dec 06, 2010 at 01:59 AM 0
Share

yeah! oops! thanks ill fix that... maybe. probebly not.

avatar image hugemaggot · Dec 06, 2010 at 08:02 PM 1
Share

when i do everything you have said when i fire my gun the bullets just drop onto the floor ins$$anonymous$$d fire out please help.

avatar image JesusChristChangedMe · Dec 06, 2010 at 09:23 PM 1
Share

Is it when you just face a certain direction it doesn't go anywhere but when you face a different direction it shoots? Try turning around when shooting, like in circles, and see what happens. If it shoots good in some directions and not in others I know how to fix it.

avatar image JesusChristChangedMe · Dec 06, 2010 at 09:29 PM 0
Share

You do have a bullet prefab correct? And it is put in the place where it says bullet-Transform correct in the inspector? There might be an issue with your prefab. Just let me know about the bullets falling on the ground thing and what happened when u faced a different direction.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Bullet does not move forward 1 Answer

A node in a childnode? 1 Answer

Only one of all my Enemies shoots, Help please. 1 Answer

How do I make a 2d bullet object move towards the players original position when it is spawned? 2 Answers

transform.TransformDirection not working -- WHAT IM MISSISNG? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges