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 randomCreator01 · Oct 23, 2017 at 06:15 PM · movementplatformerisometric

Question about moving in isometric game

Hi folks!

I'm Unity noob and I'm creating my first game. It's a isometric 3D platform game. I have small problem with my character movement which is a simple block. Whenever I move in the world it moves correctly but my character does not stay facing the direction which I have been moved. Y rotation axis just resets to 0.

I've tried everything but I haven't figured this out. I know that I must store the rotation's y-value, but I don't know how.

My character controller is done by this tutorial: https://www.youtube.com/watch?v=XhliRnzJe5g&t=1s

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

Answer by Cuttlas-U · Oct 23, 2017 at 07:27 PM

hi; can u show your script?

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 randomCreator01 · Oct 25, 2017 at 06:19 PM

Yes here it is:

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class FluffyMovementISO : MonoBehaviour {

 [SerializeField]
 public float moveSpeed;
 Vector3 eteen;
 Vector3 oikealle;

 bool hyppy = false;
 public float hyppyKorkeus;
 public float hyppyNopeus;
 Rigidbody rb;

 // Use this for initialization
 void Start()
 {
     eteen = Camera.main.transform.forward;
     eteen.y = 0;
     eteen = Vector3.Normalize(eteen);
     oikealle = Quaternion.Euler(new Vector3(0, 90, 0)) * eteen;
     rb = GetComponent<Rigidbody>();
 }

 // Update is called once per frame
 void Update()
 {
     
     if (Input.GetButtonDown("Jump") && !hyppy)
     {
         StartCoroutine(Jump());
     }

     else
     {
         
         Move();
     }
 }

 void Move()
 {
     //transform.rotation = Quaternion.Euler(0f, 90, 0f);
     //Vector3 direction = new Vector3(Input.GetAxis("HorizontalKey"), 0, Input.GetAxis("VerticalKey"));
     Vector3 rightMovement = oikealle * moveSpeed * Time.deltaTime * Input.GetAxis("HorizontalKey");
     Vector3 upMovement = eteen * moveSpeed * Time.deltaTime * Input.GetAxis("VerticalKey");

     Vector3 heading = Vector3.Normalize(rightMovement + upMovement);

     transform.forward = heading;
     transform.position += rightMovement;
     transform.position += upMovement;

 }

 IEnumerator Jump()
 {
     float originalHeight = transform.position.y;
     float maxHeight = originalHeight + hyppyKorkeus;
     rb.useGravity = false;

     hyppy = true;
     yield return null;

     while (transform.position.y < maxHeight)
     {
         transform.position += transform.up * Time.deltaTime * hyppyNopeus;

         yield return null;
     }

     while (transform.position.y > originalHeight)
     {
         transform.position -= transform.up * Time.deltaTime * hyppyNopeus;
         yield return null;
     }

     rb.useGravity = true;
     hyppy = false;

     yield return null;
 }

}

Comment
Add comment · Show 5 · 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 Cuttlas-U · Oct 26, 2017 at 05:13 AM 0
Share

in witch part of the code are u rotaiting the player ?

avatar image randomCreator01 Cuttlas-U · Oct 26, 2017 at 06:45 AM 0
Share

Rotation happens here:

Vector3 heading = Vector3.Normalize(right$$anonymous$$ovement + up$$anonymous$$ovement); transform.forward = heading; transform.position += right$$anonymous$$ovement; transform.position += up$$anonymous$$ovement;

avatar image Cuttlas-U randomCreator01 · Oct 26, 2017 at 06:53 AM 0
Share

well in both u are changing the position ; should not be some one transform.rotaition;

Show more comments

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

156 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

Related Questions

How can I add movement correction for a 2D platformer? 0 Answers

Detecting missing collision in 2D platformer to change direction for enemy - without Raycast 1 Answer

Can't move while crouched 0 Answers

How can I move my 2D car in 16 fixed angles like in Retro City Rampage 1 Answer

Help! Collision will not work, but all others will 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