Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 chaostheorygames · Apr 04, 2017 at 05:16 AM · camera3dcamera-movementtouch controlspanning

Panning camera based on a fixed point.

I have a 3D perspective camera looking down on my scene at a fixed 40-degree angle that can be panned around the scene by tapping and dragging. Pinching is also used to move the camera in and out (for zooming). The camera should never rotate from its original rotation, only translate.

I want a system where as I pan the camera around, the touch position perfectly tracks the object that was touched when the pan started, regardless of the distance that the camera is from the object.

My proposed solution was to raycast to the touch position to determine how far away it is and modify the pan amount by the distance from the camera to the raycast hit position. I quickly found that the required relation needed was not linear and seemed to be exponential (i.e as the camera moves further away from the selected object, it should pan faster to keep up). I have been playing around with values trying to get it right but it never seems to work correctly.

Is there a simple way of solving this that I am missing? I'm thinking maybe I'm missing a trig relationship to do with the camera being rotated 40 degrees on the X axis. Any help would be greatly appreciated.

Comment
Add comment · Show 4
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 VeeooshL · Apr 04, 2017 at 08:12 AM 0
Share

I don't have a complete answer, but it may help to put your camera parented to an empty gameObject that has default rotation. This way, you wont get messed up as you can move the gameObject ins$$anonymous$$d.

avatar image chaostheorygames VeeooshL · Apr 04, 2017 at 08:20 AM 0
Share

I'm not sure that will help overall. I'm not actually changing the rotation of the camera at all, so currently those values (of rotation) are not even factored into the system. I was just thinking maybe they need to be but then again it's possible I'm completely off the mark.

avatar image VeeooshL chaostheorygames · Apr 04, 2017 at 08:24 AM 0
Share

could you post screenshots? it might help. Or, even better a video/gif

Show more comments

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Camera Shake Effect When Camera Following Player 1 Answer

Click and Drag 3D Camera, like Anno 1 Answer

Jerky 3rd Person Camera Following Movement and Rotation 0 Answers

Moving between two cameras 1 Answer

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


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