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 /
avatar image
0
Question by PotatOS432 · Oct 13, 2017 at 01:14 AM · movement scripttutorialspace shooter

Space Shooter Tutorial; Player won't move as shown at 7:05 in the Tutorial Video

It pains me to come here but I am unable to figure out how to move the Ship in the Space Shooter. I have followed the video and changed the script as per the Upgraded Guide on ownCloud and looked on the forums for fixes but cannot figure it out. When I hit 'play' it enters play mode so there's no compiler errors but if I press W,A,S,D or Up, Down, Left, Right the Ship won't budge.

The Script is attached to the Player and 'Is Kinematic' is unchecked. If you need further information to aid in your answer I would be happy to provide it.

My Code is this:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class PlayerController : MonoBehaviour
 {
     private Rigidbody rb;
     private void Start()
     {
         rb = GetComponent<Rigidbody>();
     }
     void FixedUpdate()
     {
         float moveHorizontal = Input.GetAxis("moveHorizontal");
         float moveVertical = Input.GetAxis("moveVertical");
 
         Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
         rb.velocity = movement;
     }
 }

I'm sorry to repeat a question that's been asked a lot but I'm having a lot of trouble figuring this out, I'm new to coding and it's confusing jumping from the outdated video tutorial, the Upgrade Guide and forums. I just get lost. And I want to figure this out before moving onto 'Speed' section the video.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by unit_nick · Oct 13, 2017 at 03:56 AM

Lines 14 & 15. There are no axis named "moveHorizontal" & "moveVertical". Try "Horizontal" & "Vertical" in the GetAxis()

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 TBART82 · Oct 13, 2017 at 03:59 AM

@PotatOS432 So I entered your code into Unity and I found the issue. There is no Axis named "moveHorizontal" and "moveVertical". If you go to 'Edit -> Project Settings -> Inputs' you will see there are two axis called "Horizontal" and "Vertical" these are the ones you want to use. So:

Change

 float moveHorizontal = Input.GetAxis("moveHorizontal");
 float moveVertical = Input.GetAxis("moveVertical");

To

 float moveHorizontal = Input.GetAxis("Horizontal");
 float moveVertical = Input.GetAxis("Vertical");

Hopefully this helps!

TBART82

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 PotatOS432 · Oct 15, 2017 at 12:30 AM

@unit_nick , @TBART82 I feel so stupid rn haha. this worked, thank you for your help! Now i can continue :)

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

76 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

Related Questions

Why is the boundary not working? 1 Answer

My space ship is sliding to one side and getting stuck there, what would cause this? 1 Answer

The referenced script on this behavior is missing! 2 Answers

Space shooter player rotation issue 1 Answer

Space Shooter Asteroids Not Being Destroyed 3 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