Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 AnonHandler12 · Nov 28, 2014 at 12:52 AM · camerarotationcamera-movementcamera rotateisometric

Forward and back movements with a camera emulating an isometric view

Hello,

It's been three days and I still have no idea how to do this, so it's time I start bothering you all.

My problem is as follows: imagine a simple terrain object with a camera over it at a certain angle (x:60, y:0, z:0), I managed to have this camera zoom in and out, rotate using a point in the middle of the screen corresponding to a position on the terrain, and move left and right whatever the curent rotation is.

But I absolutely don't know how to have the camera move forward and back taking into account the current camera angle that may have changed due to rotation. I know it works with left and right movments because the x axis doesn't change, still I do not knwow how to work with the camera's angle when it comes to the two other movements.


CameraBehaviour.cs

     private void Move (){
         if (Input.GetKey(KeyCode.UpArrow) || Input.mousePosition.y>(ScreenHeight-ScreenLimit)){
             transform.position += Vector3.forward * MoveSpeed * Time.deltaTime;
         }
         if (Input.GetKey(KeyCode.DownArrow) || Input.mousePosition.y<ScreenLimit){
             transform.position += Vector3.back * MoveSpeed * Time.deltaTime;
         }
         if (Input.GetKey(KeyCode.RightArrow) || Input.mousePosition.x>(ScreenWidth-ScreenLimit)){
             transform.Translate(Vector3.right * MoveSpeed * Time.deltaTime);
         }
         if (Input.GetKey(KeyCode.LeftArrow) || Input.mousePosition.x<ScreenLimit){
             transform.Translate(Vector3.left * MoveSpeed * Time.deltaTime);
         }
     }

Thanks a lot for your help!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Cherno · Nov 28, 2014 at 01:59 AM

The by far easiest way it to make the camera a child of a "camera mover" empty gameobject. Put this mover on your terrain at the required height (ground height, I assume), and then change the camera's localPosition and localRotation to whatever you want. Give the mover a temporary meshrenderer and meshfilter to position the camera in a way that it looks directly and the mover (the mover is at the center of the screen).

All code concerning the movement and rotation of the camera is then actually applied to the mover.

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 AnonHandler12 · Nov 28, 2014 at 08:35 AM 0
Share

Ultimately, this is what I am going to do, yes. Thank you. But if possible, I would like to understand how I could do it using only the camera motion and rotation.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Rotating the camera over a period of time 1 Answer

How to make a 3D camera rotate relative to the world? 1 Answer

How to make the camera follow the player while still being able to be rotated? 1 Answer

Why is my camera not snapping 90 degrees? 0 Answers

How to fix weird camera rotation? 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