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
0
Question by CornDog · Apr 17, 2013 at 01:05 AM · scalemovetranslatezoom

How to scale and translate world relative to camera

Unity Answers Question

At Unite 2012 there was a presentation by the people who made Universe Sandbox. The video can be found here: http://video.unity3d.com/video/6958259/unite-2012-creating-the At about 21:00 someone asks about how they achieve the scale and they answer but with limited detail.

Based on what they talked about, they provide the scale and positioning by leaving the camera in one location, and then scaling/translating the objects within the world (so moving everything in the world but leaving the camera at [0,0,0])

My questions are these: (a) how would I efficiently translate all the objects in a scene so it appears the camera is moving, but it is, in fact, staying in the same place. and (b) how would I scale and translate the objects in a scene (when I spin the scroll wheel, for example.) so that it looks like the camera is zooming out or into a point? ie what is the math involved. The guy in the video mentioned something like taking the distance to the nearest object and then using 1/(the distance) as the scale factor. But that left some holes like how much to translate by. (unless I simply misunderstood or missed some detail)

Thanks

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 The-IT664 · Apr 17, 2013 at 03:01 AM

Unfortunately I don't have the time to write up a more detailed answer but the general concept behind leaving the camera at the origin is to transform everything else by the inverse of what would have been the camera's transform. So, for example, if you were to place all your game objects on a parent "Base" and apply the inverse of whatever transformation you would have applied to the camera, then you get the effect you are after.

a) By placing all your GameObjects on a "Base" GameObject which you apply a inverse transformations to you won't get a performance penalty.

b) Scaling and rotating objects in the scene would work in the same way as translating them. Apply an inverse rotation/scale to the Base.

Also, note that they make have used this system to get around floating point precision limitations. Make sure you fully understand the issues and limitations of floating point numbers if you plan on making a very large scale scene.

All the best!

Edit: I should mention I don't have the time or speakers to view the video. Edit2: Zooming in and out can be faked using position and scale but more correctly it is a function of the camera's field of view.

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

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

12 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

Related Questions

smooth motion 1 Answer

Moving the grabbed objects changes their scale 0 Answers

Move object forward 1 unit then stop 2 Answers

Setting pivot to the middle of two touches - 2D project 0 Answers

How to stop coroutines or functions 2 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