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 ocd93 · Jun 12, 2015 at 02:29 PM · space shooter

In the space shooter tutorial on the "creating shots" the bolt won't move

Hi im new to Unity and C#, and while doing the tutorial for the space shooter i got stucked beacuse on the las par of the session "creatin shots" the shots wont move and i don't know why, i have the same code on the script.

Here is the code:

 using UnityEngine;
 using System.Collections;
 
 public class Mover : MonoBehaviour 
 {
     public float speed;
 
     void start()
     {
         GetComponent<Rigidbody>().velocity = transform.forward * speed;
     }
 
 }

Any help will be really apreciated.

Comment
Add comment · Show 4
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 seveer4444 · Jul 22, 2015 at 05:41 PM 0
Share

I have the same exact problem with the bolt game object. I have tried to use the solutions given here but they aren't working either

avatar image nmathis · Aug 11, 2015 at 11:26 AM 0
Share

One thing I noticed on this is that the axes of the bolt seem to be rotated 90 degrees about X after creating and rotating the Quad, whereas in the tutorial video, his axes remain in the same orientation as everything else. This meant that I didn't need to reorient the collider around my bolt; does this also mean that the transform.forward command will send the beam in the wrong direction (ie down ins$$anonymous$$d of forward)?

I'm using Unity 5 on Windows.

avatar image iahr · May 18, 2016 at 08:06 AM 0
Share

it should be like this

...... public float speed; private Rigidbody rb: void start() { rb=GetComponent();

rb.velocity=tranform.forward*speed: }

avatar image skiedude · Aug 17, 2016 at 09:37 PM 0
Share

What is your speed set to in the inspector?

10 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by nuubarak · May 15, 2016 at 03:01 PM

  void start()
  {
      GetComponent<Rigidbody>().velocity = transform.forward * speed;
  }

Change to

  void Start()
  {
      GetComponent<Rigidbody>().velocity = transform.forward * speed;
  }
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 skiedude · Aug 17, 2016 at 09:38 PM 0
Share

Good eye! that happened to me during the tutorials and it took me a $$anonymous$$ute to figure out that I had lowercase start() ins$$anonymous$$d of Start()

avatar image
1

Answer by SlowestChunk · Jul 19, 2015 at 06:53 AM

I'm also very new to Unity. I've made my own solution, try this, it worked for me:

     public float speed;
     
     void Start ()
     {
         Rigidbody rb = (Rigidbody)GetComponent(typeof(Rigidbody));
 
         Vector3 movement = new Vector3 (0.0f, 0.0f, 1.0f);
         GetComponent<Rigidbody>().velocity = movement * speed;
         
     }
 }
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
avatar image
1

Answer by SlowestChunk · Jul 19, 2015 at 01:23 AM

this worked for me:

     public float speed;
     
     void Start ()
     {
         Rigidbody rb = (Rigidbody)GetComponent(typeof(Rigidbody));
 
         Vector3 movement = new Vector3 (0.0f, 0.0f, 1.0f);
         GetComponent<Rigidbody>().velocity = movement * speed;
         
     }
 }


then you get the attribute "Speed" in the "Player" Object, in the "Script Inspector" Tab. I've set the value for speed to 10.

You can take the same code for the movement of the hazards, setting the speed on -4 or as you like.

Hope this helps!

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

Answer by chetan.bhale · Jul 10, 2015 at 08:34 AM

 public float speed;
  
     void Start ()
     {
         Rigidbody rb = (Rigidbody)GetComponent(typeof(Rigidbody));
         rb.velocity =  transform.forward * speed;
            
     }enter code 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
avatar image
0

Answer by chetan.bhale · Jul 10, 2015 at 08:34 AM

Same i tried but not wroking...

Try this.....`public float speed;

 void Start ()
 {
     Rigidbody rb = (Rigidbody)GetComponent(typeof(Rigidbody));
     rb.velocity =  transform.forward * speed;
        
 }`
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
  • 1
  • 2
  • ›

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

17 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

Related Questions

Creating a spread shot using prefabs 0 Answers

When I am coding in C# for my player to move in space shooter rigidbody.velocity = movement; refuses to be recognized. Why? and what can i do to fix this? 1 Answer

How do i change controller from keyboard to mouse?? 1 Answer

How to keep player in bounds? 1 Answer

How can I call InvokeRepeating wich can be found in the start function, after I Cancelled the Invoke? 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