Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by darthbator · Oct 04, 2012 at 04:58 AM · camerarotationworldspace

Directional Scrolling with rotating camera

Ok this might get a touch lengthy so bear with me. I'm working on a game that is using mainly contextual touches for interaction (so I'm casting a ton of rays and checking layers and tags). The basic model I am using for the camera is to have it pan around on the X and Z axes by having the player "grab" an unactionable section of play area and drag the camera around. So to get that effect I have this method in my touchController feeding into the method on my camera script.

 if (landGrabbed && touch.phase == TouchPhase.Moved && rayAtTouch(out hit, touch.position)) {
                 Vector3 camDragDist = new Vector3(touch.deltaPosition.x, 0, touch.deltaPosition.y); 
                 cameraMan.dragCamera(camDragDist);
 }

That then contacts a method on my camera and moves it about.

 public void dragCamera (Vector3 scrollDist) {
         Vector3 normalizeScrollDist = new Vector3(scrollDist.x * Time.deltaTime * dragSpeed,
             0, scrollDist.z * Time.deltaTime * dragSpeed);
         transform.position += normalizeScrollDist;
 }

Works Awesome!!! Sort of.... As long as the camera is not rotated. Once the camera rotates in the world it's axes are all different and the movement is all messed up....

What's a good way to handle this? Do I make the camera a child of an empty gameObject? That way I can move this around in worldSpace while spinning around the camera? Is there a way in code the best handle this?

Comment
Add comment · Show 1
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 darthbator · Oct 06, 2012 at 11:00 PM 0
Share

Yeah I'm aware of how the system works but I still haven't been able to resolve the issue. While I believe using Quat's to rotate that vector is the correct idea it's still not working even close to how it has to.

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

10 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

Related Questions

[Solved] Translating Camera on only X, Z axis on World Space, no matter what is the rotation 0 Answers

Quaternion Slerp Sanity Check 1 Answer

How to freeze the rotation or the position on the camera transform? 1 Answer

how do i make first person character rotate left and right along with camera? 0 Answers

Override Oculus Orientation 5.3 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