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 abduct · Oct 26, 2013 at 02:08 AM · rotationcubeslevel designquads

Rotating quads and check if 2 sides touch another quad

Hi, all. I'm new to unity and I'm loving it so far. I've successfully wandered around it and learned quite a bit, but I am looking for a couple of specific functions to do what I need.

Basically, I created a script which I put onto a empty GameObject which randomly generates a array X * Y, and from there procedurally creates a "house" persay with doors, rooms, walkways, map boundaries, and the like.

http://i.imgur.com/d9UxVfM.png

As you can see it works fairly well for being whipped up in a short amount of time (did the generation code in C then ported to C# for unity).

My problem is, when I use cubes it works fine and there are no gaps or anything out of the ordinary, which is fine, but cubes are bulky and not very wall like. This is where I though of using quads.

http://i.imgur.com/jX4c6y6.png http://i.imgur.com/pnQPK16.png (sorry for a bad screenshot of the problem but you can sort of see it)

When using quads, they are all on edge like walls which is great, but they all face east/west. What I need to figure out is how to rotate specific quads so that some are facing east/west and the others are facing north/south to create walls. Another problem I for see is the quads are centered in the squad grid, so I would also need to position them on the right side and the top side of the square grid.

There is no way to tell which way walls should be facing programmically from my generation code (unless i revamp it), so I have to do it through unity and and rotate and check if it fits into place.

Here is the sample of how my Array looks like printed out to terminal so you have an idea of what I'm working with.

http://i.imgur.com/2xtKTRt.png

X are boundaries, # are walls, + are doors, . are floors/corridors. As you can see there is no way to tell a east/west wall from a north/south wall unless I add in a new symbol as I generate the map.

Hopefully someone can point me to a few functions/code samples which could lead to a solution to this.

PROBLEM: Need to rotate north/south facing walls 90 degrees so they mate with east/west facing walls, as well as move them to the right side/top side of the square grid.

Potential solutions (I think) Recode part of my level generation script to use a different symbol for the two walls, so I can simply draw different walls when I spawn them.

Or

Figure out if the wall is a north/south wall via unity objects, and rotate them.

Thanks for any help and sorry for the long question, I tried to provide as much information as I could without dumping 500 lines of code on here.

Comment
Add comment · Show 1
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 · May 24, 2014 at 01:08 AM 0
Share

I agree with @GhastAvitor that you likely don't want quads for this purpose. Quads are one sided with the use of most shaders, which means that if you look at the back side, they quad disappears. I don't know your use for these walls, but quads are also one sided with respect to collisions. You can scale boxes boxes to be thinner, but you will have to solve the problem of identifying N/S vs E/W to know which axis to scale.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by GhastAvaitor · May 24, 2014 at 12:00 AM

Go back to cubes. You can rescale them via code and make them less bulky. Quads are not good for walls, they are good for 2D or menus. That is about it.

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

16 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

Related Questions

A node in a childnode? 1 Answer

Twin Stick Shooter controller 0 Answers

RotateAround Limitations 2 Answers

Rotating sprite through touch (storing current rotation) 0 Answers

Sphere rotation in moving direction 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