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 GameDev2012 · May 16, 2012 at 01:25 PM · cubedetectionfacecolourcubes

3D Cube Face Detection

Hi,

I have a set of 3D cubes placed evenly next to each other with different coloured faces, but I need to detect which face is currently showing towards the user. I have managed to use the "Forward" + "Up" calculations to detect when the cubes are all facing in the extact orientation, however I very urgently need a way to do the same thing with only the the face colour showing the user being the same! I.E. All cube faces have a different colour, as we all know the cube can show the same colour to the user but be of different orientations... This is what I need to do, but currently my game code only allows the "exact" cube orientation to react. I need to find a way to detect for example, when all cubes show the colour "Red" to the user - regardless of the orientation of the cubes. Could anyone please suggest anything or maybe something I have missed with using the "Forward" + "Up" detection method ???? Any help would be greatly appraciated.

Regards, Jimmy.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Drakestar · May 16, 2012 at 02:24 PM

You figure out how much a vector is facing another vector by calculating the dot product between the two. In this case, you'd use the camera's facing direction and the normal of the side of the cube that is facing you. There are lots of information and examples around if you look for "Unity Vector3.Dot"

An even easier solution, though, would be to compose the cube out of six individual planes (or parenting them to each side of the cube) - that way, you don't have to bother with extracting the individual face normals from the cube (or trying to compute it based on the cube's rotation).

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Creating multiple faces (cubes) 1 Answer

How to change diffrent material/texture for diffrent faces of Cube 1 Answer

Building with cubes in Unity,Building meshes out of cubes 0 Answers

AR Foundation Examples 0 Answers

dllNotFoundException-EmguCv-HaarCascading 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