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
0
Question by cbissett · Feb 02, 2011 at 02:50 AM · shootingbullet

Shooting causes character to shoot forward

I am just playing around with a basic FPS and i am very new to unity and scripting. I have a character and a script written to shoot a bullet from a spawn point right in front of the gun. When i shoot the bullet sometimes it causes my character to go flying forward across the screen. As of now i have a rigidbody on the character and the bullet. I also have a script that destroys the bullet after 1 second. Is there anything I can change to make my character to not fly forward?

The script I used for shooting is:

var Bullet : Transform; var bulletSpeed : float = 5000;

function Update () { if(Input.GetButtonDown("Shoot")) {var shoot = Instantiate(Bullet, GameObject.Find("SpawnPoint").transform.position, Quaternion.identity); shoot.rigidbody.AddForce(transform.forward * bulletSpeed);} }

Thanks for any help

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by BurningThumb · Feb 02, 2011 at 03:16 AM

Place the bullet and player on separate layers, then in the edit->project settings->physics uncheck collision between those layers in the matrix.

Your player is most likely colliding with your bullet.

Comment
Add comment · Show 1 · 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 cbissett · Feb 02, 2011 at 03:35 AM 0
Share

Ok i have one more problem when i am moving forward and right nothing shoots. As of now i have "w" for forward and "d" for right. To shoot i am using "e" is there a way to fix that?

avatar image
0

Answer by cbissett · Feb 02, 2011 at 03:46 AM

Ok i have one more problem when i am moving forward and right nothing shoots. As of now i have "w" for forward and "d" for right. To shoot i am using "e" is there a way to fix that?

Comment
Add comment · Show 1 · 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 Parthon · Apr 01, 2011 at 11:22 PM 0
Share

Afraid not, that's a keyboard thing.

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

Shooting Accuracy Problem 0 Answers

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

Predict Collision 0 Answers

need help with instantiating for making a bullet shoot 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