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 Ronnie-Grahn · Sep 21, 2017 at 02:23 PM · unity 5collider3dmeshcollidertiling

Tiling problem: how to know where to put next tile?

I'm trying to create a walkway in a random fashion where the tiles spawn one after another. The length I have figured out how to tile correctly but I'm having problems with where the next tile should be set on the x.axis (the 'width'). Lets take the 3D object below as an example.

alt text

If I want to connect this object with another in the bottom left corner (to make a continous walkway), what would be the best way to go about this? This is the first time I have been playing around with bounds but can't get that to work. Is there a way to get the length of the collider in just that part? Is raycasting the prefered way here?

Any help in getting my head around this is much appreciated.

Cheers, RG

object.png (30.8 kB)
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 tyjkenn · Sep 21, 2017 at 02:42 PM 0
Share

Are all the tiles the same size?

avatar image Ronnie-Grahn tyjkenn · Sep 21, 2017 at 03:00 PM 0
Share

No, that's the thing. I want to be able to have different sized objects and objects with very different paths inside them, if that makes sense. Now, they will roughly be the same size, maybe between 5-20 unit lengths, so they wont be insanely different in size.

1 Reply

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

Answer by tyjkenn · Sep 21, 2017 at 03:12 PM

One option is to mark the start and end of each tile. Do this by creating two empty GameObject children for each tile. Position one at the beginning. Rotate so its forward is into the tile. Position another at the end. Rotate so its forward is out of the tile. To connect the tiles, you just need to align the start of the next tile with the end of the last, and rotate it so that the two markers are facing the same way. Save this as a prefab for each tile in your tile set, and then add something like this to your tile script:

 public Transform start;
 public Transform end;

 //This would get called shortly after instantiation to align it with the previous tile.
 void Connect (Tile prev) {
     transform.position = new Vector3(0, 0, 0);
     transform.rotation = transform.rotation * (start.rotation.Inverse * prev.end.rotation);
     transform.position = prev.end.position - start.position;
 }
Comment
Add comment · Show 2 · 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 Ronnie-Grahn · Sep 21, 2017 at 03:57 PM 0
Share

Ah, I was thinking along these lines also (you can see a small green outline in the "end" part where I have a small anchor point).

Your solution looks promising, I will test it out tonight or tomorrow!

avatar image Ronnie-Grahn · Sep 26, 2017 at 01:03 PM 0
Share

Works good for my needs!

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

153 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Best way to make this grid 0 Answers

How do i code a Mesh collider ? 1 Answer

Mesh collider without Rigidbodies 1 Answer

When I look around, my character rotates in a weird circle and it causes it to move around. 0 Answers

Rotate camera only in 2 directions based on player touch 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