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 /
avatar image
0
Question by StuwuStudio · Jan 02, 2016 at 07:04 PM · objectarraystransform.positionobjectscenter

How to get the size of an array of object?

Hello, I work on a agar.io style of play and I do not know what to do to get all the objects and the screen by changing the camera's size. I don't know what to do. Maybe get the distance of the most far away object. Any suggestions? 'I can't give the script, sorry.'

Comment
Add comment · Show 2
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 ShadyProductions · Jan 02, 2016 at 07:40 PM 0
Share

what exactly do you mean with "all the objects"? every gameobject in the game? and what changing camera size? sorry but be more specific I don't understand what you want.

avatar image AlanGreyjoy · Jan 03, 2016 at 01:33 AM 0
Share

Terrible English... we can tell. But thats ok :) I am just going take a stab in the dark and guess at what you mean.

"How to get the size of an array of object?" arrayName.length;

"I do not know what to do to get all the objects and the screen by changing the cameras size" foreach(Stuff stuff in Otherstuff)

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by hexagonius · Jan 03, 2016 at 05:06 PM

Here you will find several formulas to calculate the frustum.

Adding all positions together and dividing them by their count gives you the center between them.

The rest ist figuring out camera position from that point and setting it's FOV.

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 StuwuStudio · Jan 04, 2016 at 09:37 PM 0
Share

Center the camera work perfectly! But for setting the FOV, i tried an other solution; the the distance between all object. I work too.

avatar image
0

Answer by StuwuStudio · Jan 03, 2016 at 04:36 PM

I hate google tradution... By 'size of an array' i mean; if i have 3 objects in my array (gameobject), my camera need to get all them in the screen by changing the field of view and place the camera in center of the 3 objects.

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

36 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

Related Questions

Creating custom objects? 2 Answers

Iterating a GO through an array of transform positions 0 Answers

ObjectPicker Source Code? 0 Answers

Can't get more than one object. 1 Answer

Object carry in game 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