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 Phoskryfes · Nov 28, 2012 at 11:29 AM · bulletshoot

Bullet not moving

I created a script so that when the player pressed the left mouse button, it would put a bullet out. It works. I created a prefab and it is circle. I put this script and the problem is that if I press the left button, it does go out but it doesn't move. Could you help me with my script?

 //Make it into trigger.
 Function OnUpdate ();
 // Destroy object incase it goes on and on
 Destroy(gameObject. 3);
 //Keep this going
 Vector3.moveObject
 //Make it spawn at gun.
 position.transform(Find.gameObject("Gun");
 
 Function OnTriggerEnter (enemy:Collider);
 // Destroy object when it hits enemy to avoid multiple damage
 Debug.Log("Trigger is on");
 if(other.gameObject.FindWithTag("enemy");
 Debug.Log("It hits enemy.");
 Destroy(gameObject);
 
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 DeveshPandey · Nov 28, 2012 at 11:36 AM 0
Share

have you added a force to a bullet? or have you done anything to move the bullet?

avatar image Phoskryfes · Nov 29, 2012 at 11:34 AM 0
Share

I really don't know how to move objects by it's own.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Landern · Nov 29, 2012 at 01:53 PM

First, this question is.. i swear asked daily, a simple search for bullet on unity answers/forums will give you so much information, but its all pretty much the same, but it's already been answered over and over and over and over .. ad nauseam.

Now..

If you have a rigidbody attached to the bullet, this gives the game object the capabilities of automagical physical, i know that sounds all great and awesome, but, having the rigidbody doesn't mean any force(s) are applied, so you have to give it the force of forward momentum. This is done with a single line in the script.

Without the rigidbody you will need to control the game object transform position by hand, through the script, otherwise, yes, the bullet(or whatever) will just sit there.

But really, check out the search function, it's METAL!! and by that, i mean you will find all the information.

Comment
Add comment · Show 3 · 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 Phoskryfes · Nov 29, 2012 at 02:08 PM 0
Share

I just have 1 question, how do you put force?

avatar image DeveshPandey · Nov 29, 2012 at 02:14 PM 1
Share

See this : http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddForce.html

avatar image Landern · Nov 29, 2012 at 02:17 PM 0
Share

@DeveshPandey: Thank you

@Jodhale: besides the documentation, which is important to understand, using the search features of the site will extend you knowledge further because most standard/normal/fps questions have been asked over and over, there are many examples and tutorials available, enjoy.

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

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Spawn Script Not Working 1 Answer

Problem creating a 2D scroller shooting game 2 Answers

Main Menu Problem 0 Answers

Hey can anyone help with a shooting script??? 0 Answers


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