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 KG911 · Mar 11, 2019 at 07:38 AM · character movementisometric

Help for Isometric 4-direction Player Movement?

So I'm attempting to make a character move in 4 (or 8, with combined keypresses) directions on a flat 2D background, and I found a tutorial which seemed to be a solution, but it turns out that even though their sample game clip moves in all directions on a flat plane, it doesn't work that way on mine. In my game, my character moves just fine left and right, but I can't move up or down or diagonally. I tried replacing the 0 in the Vector3 to include a third axis, but that didn't work. This script works perfectly beyond not being able to move up, so how do I add movement up and down? I know 2D characters can move up, because in platformers you can jump...

I'm using this setup on the inspector:

alt text

This is my prototype scene:

alt text

I'm using this script as my base:

 using UnityEngine;
 
 using System.Collections;
 
 
 
 public class PlayerController : MonoBehaviour
 {
 
 
 
     public float speed = 6.0F;
         
     private Vector3 moveDirection = Vector3.zero;
 
     public CharacterController controller;
 
 
 
     void Start()
     {
 
         // Store reference to attached component
 
         controller = GetComponent<CharacterController>();
 
     }
 
 
 
     void Update()
 
     {
                 
             // Use input up and down for direction, multiplied by speed
 
             moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
 
             moveDirection = transform.TransformDirection(moveDirection);
 
             moveDirection *= speed;
 
         
         // Move Character Controller
 
         controller.Move(moveDirection * Time.deltaTime);
 
     }
 
 }

I've made simple games before in other engines, but this is driving me nuts! My research for this engine said to use Input.GetAxis instead of getting a particular key pressed, to avoid issues with people using a controller versus a keyboard and mouse. I'm mainly familiar with setting all possible keys and buttons for a specific action required and then calling the action for use with any linked input, but apparently Unity doesn't work this way? I've researched this for hours and have not found a script solution for this, please help.

inspector.png (52.9 kB)
scene.png (7.3 kB)
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 xxmariofer · Mar 11, 2019 at 09:02 AM 1
Share

you are moving in the z axis when i imagine you are trying to move in the y axis.

 moveDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
avatar image KG911 xxmariofer · Mar 15, 2019 at 01:27 AM 0
Share

Thank you for replying; that did the trick!

0 Replies

· Add your reply
  • Sort: 

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

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

What is a good way to have my player grab and roll a boulder like in Tomb Raider isometric games 0 Answers

How can I display text over a sprite in isometric perspective?,Text on isometric tile 0 Answers

Help! My third person character needs and exorcist! 1 Answer

Why doesn't my character move? 0 Answers

How to make the character roll and also resize the collider? 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