Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by MatchesMalone · Jul 27, 2017 at 09:48 PM · rigidbodymonodevelopspeedtutorialtutorials

Space Shooter Bolt Speed Forward Issue

Hello, I've been digging around in the site's past posts for an issue I have with what I believe the version changes with C# in the following step of the Space Shooter Tutorial:

  • Creating Shots : https://unity3d.com/learn/tutorials/projects/space-shooter-tutorial/creating-shots?playlist=17147

I'd made it to the last step of the tutorial where you test the bolts firing by entering the Game view and then dragging the PreFab item bolt into the Hierarchy. The expectation was that the bolt should fire forward at a speed of 20. Unfortunately that is not the case. When I drag it into the hierarchy it just sits in place taking no action what so ever.

Here is the code that I'm using in my Mover.cs file from the tutorial:

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

Any suggestions? I know the tutorials have depreciated to new code at this point, but I believe I'm doing this correctly yet no luck.

Thanks in advance.

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
Best Answer

Answer by MatchesMalone · Jul 28, 2017 at 02:24 PM

Okay, so I found my answer.

As it would turn out, the only thing that was wrong in my code was that "start" should have been capitalized to "Start". The following code works just fine when I have it corrected.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class Mover : MonoBehaviour 
 {
     public Rigidbody rb;
     public float speed;
 
     void Start ()
     {
         rb = GetComponent<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
avatar image
0

Answer by LSPressWorks · Jul 27, 2017 at 10:14 PM

What is actually happening?

"This is not the case." Doesn't describe the problem enough to help. I am assuming, since only a handful of things can happen that the shot isn't moving. Given the simple nature of the code, there are limited options to troubleshoot.

1: Are you pressing "Play"? Being in Game view doesn't make it go if that isn't pressed. Plop it in the design view, and when you press "play" it will switch to Game View. 2: Is the bolt constrained in any way? 3: What are the properties of the bolt's Rigidbody? Drag, mass etc. 4: Is it in view of a camera? Putting it into the hierarchy instead of dropping on the design side in view of a camera can lead to things having off screen coordinates.

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 MatchesMalone · Jul 28, 2017 at 12:51 PM 0
Share

Ah, sorry. You are correct. I updated the original post, but here is an update directly to your follow up questions too:

When I drop the bolt into the hierarchy it takes no action. It simply sits there without motion forward.

  1. Play is pressed before moving the bolt into the hierarchy. I also tried before thinking maybe I missed that order of operation, but no change.

  2. I do not believe the bolt is constrained in any way. There seem to be no other elements residing in the same space as the bolt.

  3. The properties of the rigid body are as follows: – $$anonymous$$ass: 1 – Drag: 0 – Angular Drag: 0.05 – Use Gravity: Unchecked – Is $$anonymous$$inetic: Unchecked – Interpolate: None – Collision Detection: Discrete – Constraints – Freeze Position & Freeze Rotation: All unchecked for x, y, z

  4. It is in view of the camera. When I drop the bolt into the hierarchy it does appear in my game view which is currently set to the only camera I have in my main scene.

I hope this helped to illustrate what I'm seeing better. Thanks for the assistance.

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

131 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 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 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 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 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 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 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

Getting two Objects to the same direction with different speed 0 Answers

Tanks Tutorial Image separating 0 Answers

Roll-a-ball Tutorial - Player Moving without input 0 Answers

"Moving the player" tutorial contains errors- please assist. 0 Answers

Sphere with rigidbody and playercontroller script stuck in plane and wont move 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