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 amgadserry · Feb 16, 2017 at 03:00 AM · scalescalingmeasure

global way of measuring size of game objects

I'm trying to put a primitive unity cube exactly above the shelf shown in the image (it was taken out of its model) so the equation iam using is box's position = (shelf's position.x , shelf's position.y + (shelf size in y axes /2 ) + ( box's size in y axes /2 ) , shelf's postion.z) but neither lossyscale nor local scale return the desired size.

so as shown in the image i want to measure the size of the object relative to the global 1*1 square grid so for the z axes it should return 2 and for the z axes it should return .75 .

alt text

untitled.png (78.3 kB)
Comment
Add comment · Show 3
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 Firedan1176 · Feb 16, 2017 at 03:18 AM 0
Share

Is your model in the correct units when you import it into Unity? Either that, or the parent of the box is not where it should be, position-wise.

avatar image hexagonius · Feb 16, 2017 at 10:25 AM 0
Share

telling from the inspector, z is 4 and x is 37,5. so z is twice a unit and x is 50 times a unit. I think you should get your scales right in your modelling tool. other than that, the $$anonymous$$eshFilter.$$anonymous$$esh.Bounds are probably also relevant besides the scale.

avatar image amgadserry · Feb 16, 2017 at 10:40 AM 0
Share

Iam very new to the whole modeling and game dev thing i made the model.in blender the cube in the picture has different dimensions in blender (75,8,200 and z axis and y axis are switched

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Anupam13 · Feb 16, 2017 at 01:48 PM

Steps- 1)Fill a square grid completely with your box/rectangle so that it accurately fits into the grid. 2)Note the x,y,z scales of the box and set them as the 'scaleFactor' for corresponding directions. E.g-scalefactorX=box.transform.localscale.x. 3)Take your original box that you want take the details of.(not the one that fills the grid to find scalefacors). 4)Now divide the localScale of each axis with the respective scaleFactor, which will return the generalized scale of your box with repect to global grids. e.g- your desired output should be Vector3(box.transform.localScale.x/scalefactorX,box.transform.localScale.y/scalefactorY,box.transform.localScale.z/scalefactorZ)

P.S.- this approach will give the accurate volume and edges of simple figures like rectangle, cube, cuboids etc. but for complex shapes, you will only get the corresponding localScales of a given game object.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Extraction of Coordinate and Scaling it down by half. 1 Answer

scaling objects with rigidbodies 2 Answers

Scaling and performance? 0 Answers

How to move button for it not to brake on different resolutions 1 Answer

Player Car Runtime Scaling Issue 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