• 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 Cognitive Dissonance · Mar 14, 2014 at 06:23 AM · 2dtransformspritetiles

Pixel Perfect

Hello everybody, hope you're having a nice day :).

I was attempting to place tiles on the editor in a perfect manner (meaning precisely next to each other).

In example, assuming we have a 50x50 sprite placed at x:0,y:0 and its 100 pixels to units. One would expect that moving the next tile by x:0.01 would perfectly fit them next to each other, however, the number i actually have to use is something around 0.0405.

I cannot see the correlation.Any ideas suggestions appreciated. Thanks for taking the time : )

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 robertbu · Mar 14, 2014 at 06:47 AM 0
Share

If your sprite is really 50 x 50 and it is 100 pixels to the unit, then I would expect your sprite to be 50/100 = 0.5 units on a side. I would expect that the distance to move would 0.5 units. These are world units, not pixels. Neither your 0.01 nor your 0.0405 make sense make sense to me.

avatar image Cognitive Dissonance · Mar 15, 2014 at 09:07 AM 0
Share

Thank you, i suppose the answer i was looking for was the pixelsammount/pixels to units thing. Was facing he ol' you dont know what you dont know problem.

Is there a way to speed up the process ins$$anonymous$$d of doing everything manually however? Tiling 400 sprites by hand and calculations is a somewhat tedious and error prone. ( Im thinking a snap to grid function or something similar)

Thanks a bunch for helping out. Have a great day :)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Ed unity · Mar 14, 2014 at 03:08 PM

This may be of use to you. Sprite.bounds

(http://docs.unity3d.com/Documentation/ScriptReference/Sprite-bounds.html) (http://docs.unity3d.com/Documentation/ScriptReference/Bounds.html)

The next tile would be the distance between the min.x and the max.x or the min.y and the max.y, depending on which direction you are trying to tile.

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 Cognitive Dissonance · Mar 15, 2014 at 09:09 AM 0
Share

That helps as i need to tile a few sprites through program$$anonymous$$g as well. However im mostly interested in how to tile things through the editor in a perfect manner since im mostly looking at static level design. Thanks a lot :)

avatar image
0

Answer by Cognitive Dissonance · Mar 15, 2014 at 11:17 AM

To attempt to answer my own question here's an idea derived from what people have answered so far. What if i created an object that holds empty children objects spaced in fixed x/y distances through code and use that as an empty grid that will be populated by the sprites im using as tiles.

Thats just a workaround to the fact that the editor does not have a fast way of placing tiles perfectly next to each other. Does that sound completely retarded :P? Thank you everyone

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

[2D] - Moving the child moves the parent <-- Unwanted behavior 1 Answer

How can I make a 2d sprite shoot the direction player is facing? 2 Answers

transform.position not doing anything 1 Answer

Is there another way of making a Top-Down-2D Map other than generating hundreds of Spriterenderes? 1 Answer

Gaps sometimes appearing between 2D sprites 14 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