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 user-12502 (google) · May 07, 2011 at 01:26 PM · geometrytrigonometry

Plane inclinated width projection

Hi everybody!.

I've a problem in Unity.

I've a plane inclined of a certain degree (say 60 degree). I would like to compute what is the projected width occupied by the plane.

I'll try to explane better. When plane is 90 degree inclinated is perpendicular to the bottom. So is projected width is 0 (or at most 1).

When the plane is 60 degree inclined, its projected width should be cos(60) * plane.height = 1/2.

However i don't know how is the correct way to do this in Unity: compute the projection via Script.

Can you help me, please? Thanks.

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 Jesse Anders · May 07, 2011 at 04:05 PM

Strictly speaking, the 1-d projection of a plane is either zero (if the axis onto which the plane is projected is parallel to the plane normal), or infinite.

However, Unity somewhat liberally uses the term 'plane' to refer to a rectangle, which I assume is what you're referring to here.

Have you tried cos(angle) * plane_height? Unless I'm missing something, that should give you the value you're looking for.

Comment
Add comment · Show 3 · 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 Owen-Reynolds · May 07, 2011 at 06:07 PM 0
Share

$$anonymous$$athf has the trig functions. The width is probably going to be the collider width: transform.GetComponent<BoxCollider>().size.x (C#) A hack is you could child an empty to the tilted end and just read the position -- let Unity do the math: transform.Find("endP").position.x - transform.position.x

avatar image user-12502 (google) · May 08, 2011 at 01:31 PM 0
Share

So now my question is: How can i access to the plane height and width; $$anonymous$$y Plane does not have a Box collider attached. Only a $$anonymous$$esh Collider.

avatar image Owen-Reynolds · May 08, 2011 at 03:20 PM 0
Share

So, the mesh collider is because it has humps on top? You could look at compound colliders http://unity3d.com/support/documentation/Components/class-BoxCollider.html. For a $$anonymous$$eshCollider, can look at bounds (but only if not rotated) or search through the vert array for highest x/z http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$esh.html

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

No one has followed this question yet.

Related Questions

Define circle using 3 points 0 Answers

Given two vectors on a sphere, rotate an object between them. 0 Answers

Not so much a scripting problem - Just need smart peoples' help. 2 Answers

SetFromToRotation vs SetLookRotation 2 Answers

Move spheres to form triangle 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