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 geo1234 · Mar 04, 2014 at 06:05 AM · playermovecannot

space shooter tutorial, cannot move player

Hi was wondering if someone could help me with this, ive just started the space shooter tutorial, Ive got to step 6 "moving the player", I did the first part of the code

 using UnityEngine;
 using System.Collections;
 
 public class PlayerController : MonoBehaviour 
 {
     void fixedUpdate ()
     {
         float moveHorizontal = Input.GetAxis ("Horizontal");
         float moveVertical = Input.GetAxis ("Vertical");
 
         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
         rigidbody.velocity = movement;
     }
 
 } 

no compile errors of any kind, when I go to play mode with the "game" window selected, I cannot move the player with the keyboard, ive tried using the arrow keys and wsad, the ship just stays in one spot with the engine running. Thank you

Comment
Add comment · Show 1
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 MrYOLO · Mar 04, 2014 at 06:17 AM 0
Share

Can you just make the mass of rigidbody really small(like 0.001), cause the rigidbody,velocity = movement just gives a very small value that can hardly move the gameobject. Another way is to multiply a speed to the movement. like rigidbody.velocity = movement * 100;

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by robertbu · Mar 04, 2014 at 06:14 AM

Your issue is that 'fixedUpdate' should be 'FixedUpdate' with an upper case 'F'. Case matters in C#, and it is pretty easy to incorrectly the name of a callback.

Comment
Add comment · Show 4 · 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 Bojamijams · May 15, 2014 at 11:59 PM 0
Share

Oh my god, THAN$$anonymous$$ YOU! That was it!

I contacted Unity to update the tutorial video as the video shows it as 'fixedUpdate'. I'm not sure if the $$anonymous$$ac version of $$anonymous$$onoDevelop is not canse sensitive in C# or (more likely) that the video is using a different script but talk about a rage inducing road block!

avatar image jamesym100 · Apr 11, 2015 at 07:54 AM 0
Share

I have the same problem and I checked this but I have done it with caps. dont know whats wrong.

UPDATE: figured it out. I expected it to be mouse controlled. it is keyboard controlled. (thanks for mentioning that).

avatar image gotoAndBliss · Aug 04, 2016 at 12:53 PM 0
Share

What?! lol, why doesn't Unity update that?

avatar image unity_xs8FsDuBDG-wFA · Feb 15, 2018 at 08:08 PM 0
Share

Hi in my case none of the above helped. I had to do this:

rb.velocity = movement * 35;

as mentioned here: https://answers.unity.com/questions/1273468/space-shooter-tutorial-player-wont-move-1.html

Hope it isn't a coding issue that's gonna bite me down the line...

:)

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

25 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

Related Questions

Opening a door at proximity 2 Answers

How can i do so when my car moves an object follows it? 1 Answer

3rd person player 0 Answers

Directional Movement - Input position calculation? 2 Answers

Player moving opposite direction when there is a new touch. 2 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