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 Starman385 · Jul 16, 2013 at 08:53 AM · fpsshootergunfire

Gun Shooting bug

Hi,

I'm new to scripting and Unity and I'm trying to make a gun shoot. I have the gun, the bullet model, the bulletspawn and the scripts. But there is something wrong with the GunShoot script and the BulletSpeed script.

Here is my Gun Shoot script:

 var BulletSpawn : Transform;
 var Bullet : GameObject;
 
 function Start () {
 
 }
 
 function Update () {
 if (Input.GetButtonDown ("Fire1"))(
 Instantiate(Bullet ,BulletSpawn.transform.position , BulletSpawn.transform.rotation));
 }

Here is the script that I use to set the speed of the bullet:

 var BulletSpeed = 5;
 
 function Start () {
 
 }
 
 function Update () {
 Transform.UnityEngine.Translate(Vector3.Forward * Time.deltaTime * BulletSpeed);
 }
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 robertbu · Jul 16, 2013 at 08:55 AM 0
Share

Saying "there is something wrong" does not tell us anything. You need to describe what you want it to do and what its doing. Right now I can tell you that the bullet script will not compile. There is no such thing as 'Vector3.Forward' with an upper case 'F'. It should be Vector3.forward.

avatar image Benproductions1 · Jul 16, 2013 at 11:02 AM 0
Share

@robertbu I don't understand how people don't see the giant error warnings when they try to play with broken scripts. Worst part is: "There's a thing giving me information I don't understand. Lets leave all that information out when we ask people about this problem"...

a good reason not to start leaning program$$anonymous$$g in a very feature-full development environment :)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by vinod.kapoor · Jul 16, 2013 at 11:57 AM

//first script code

var BulletSpawn : Transform; var Bullet : GameObject;

 function Start () {
  
 }
  
 function Update () {
 if (Input.GetButtonDown ("Fire1")){
 var bullt : GameObject = Instantiate(Bullet ,BulletSpawn.transform.position , BulletSpawn.transform.rotation) ;
 }
 }
 
 
 // second script code



 var BulletSpeed = 5;
  
 function Start () {
  
 }
  
 function Update () {
                 transform.Translate(Vector3.forward * Time.deltaTime * BulletSpeed);
 }
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 amphoterik · Jul 16, 2013 at 12:04 PM 0
Share

Please fix the code in your answer. Also, would you $$anonymous$$d explaining what you changed / improved? This will help people who see this in the future.

avatar image vinod.kapoor · Jul 17, 2013 at 05:24 AM 0
Share

in his second script, he has written

 Transform.UnityEngine.Translate(Vector3.Forward * Time.deltaTime * BulletSpeed);

Transform(with capital T)represent class and transform(with small T) represent the object of this class. so we nee to use transform(with small T) ins$$anonymous$$d of Transform. another thing is There is nothing like Vector3.Forward(capital F in forward). ins$$anonymous$$d it is Vector3.forward(small F)

avatar image vinod.kapoor · Jul 17, 2013 at 05:26 AM 0
Share

http://answers.unity3d.com/questions/451787/difference-between-transform-vs-transform.html

avatar image
0

Answer by MILLIMEDIA · Nov 01, 2019 at 06:21 AM

Consider shooting with raycasts instead of a visible projectile. Have a look here

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

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

19 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Please help me with this shooting script. 0 Answers

ufps package freezes when adding inventory system 0 Answers

Awareness script doesnt work 0 Answers

When my button is pressed the action reapeats 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