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 egonspengler_84 · Apr 13, 2021 at 05:31 PM · normalsangles

Can someone explain why the angle between the Normal and Global Up equals the angle of the slope of the ground?

So I have a simple platform 2D project going on in Unity at the moment and I'm following a tutorial on how to get the player GameObject to travel up angled slopes. Part of the tutorial involves calculating the angle of the slope of the ground that the Player GameObject is walking on. You do this by firing a raycast from the right bottom corner of the Player GO and then get the Normal of the collision between the raycast and the ground. In the tutorial the guy states that you can then calculate the angle between between the Normal and Global Up by using Vector2.Angle.

This angle happens to also equal the angle of the slope that the player GO is moving on but I don't understand why this is? Does it have something to do with the Pythagoras Theorem? Can someone explain what I ask in simple terms? 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
3
Best Answer

Answer by Hellium · Apr 13, 2021 at 07:48 PM

Because a picture is worth a thousand words:

alt text


For a scientific proof:

Let's draw an imaginary plane parallel to the (xz) plane.

Let's be:

 - A, the intersection point between the surface and the world's (xz) plane.

 - C the intersection point between the surface and the imaginary plane parallel to the (xz) plane

 - O the intersection point between the surface and its normal

 - B the intersection point between the surface's normal and the imaginary plane

 - N the intersection point between the (xz) plane and the world Y vector going through O

 - M the intersection point between the imaginary plane and the world Y vector going through O


 - α the angle between the (xz) plane and the surface: α = NAO

 - β is the angle between the surface's normal and the world (global) Y vector β = MOB

 - γ is the angle between the surface and the world Y vector γ = MOC

(see 3rd drawing below).


Thanks to the parallel lines theorems, we know that the alternate interior angles are equal, i.e MCO = NAO = α and that OMC = 90°


We also know that the sum of the angles of a triangle equals 180° so MCO + COM + OMC = 180° ⇔ α + γ + 90° = 180° ⇔ γ = 90° - α.


We also know that BOM + MOC = BOC ⇔ β + γ = 90°


If we replace γ = 90° - α in β + γ = 90°, we end up with β + (90° - α) = 90° ⇔ β = α

alt text


angle.png (88.7 kB)
normalangles.gif (472.3 kB)
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 egonspengler_84 · Apr 17, 2021 at 01:35 AM 0
Share

Okay I accept that the angles are the same but what makes them the same? How are they proven to be the same? How do we know for sure?

avatar image Hellium egonspengler_84 · Apr 17, 2021 at 10:33 AM 0
Share

@egonspengler_84 I've added the scientific proof with drawings, theorems and calculus

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

115 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

Related Questions

make one thing flat to another 1 Answer

Getting slope angle from normals. 3 Answers

Getting Player GameObject to rotate to the slope of the ground it is walking on 1 Answer

Calculate collision angle [c#] Weird results? 1 Answer

Shade Based on Normal Map World Position Angle (Updated) 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