• 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 /
This question was closed Aug 30, 2012 at 04:41 PM by easilyBaffled for the following reason:

Other

avatar image
0
Question by easilyBaffled · Aug 29, 2012 at 08:57 PM · raycastvector3anglenormal

Angle between Ray and Normal

I am shooting a ray at the ground at Vector3(0,-1, .1743) roughly at -5 degrees from down. Then I am getting the normal of what it hits. Next I want to get the angle between the ray and the normal. The ground is flat so When I use `Vector3.AngleBetween(hit.point (or Vector3(0,-1, .1743)), hit.normal);` It should give me 5 right? Well no for some reason it gives me anything but. Am I using Angle wrong, is there a better way to do this?

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

  • Sort: 
avatar image
1

Answer by ScroodgeM · Aug 29, 2012 at 09:25 PM

use .Angle()

http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Angle.html

AngleBetween is deprecated

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 easilyBaffled · Aug 29, 2012 at 09:35 PM 0
Share

I had tried .Angle() before and it didn't do any better. But thank you anyways I was woundering what the difference between the two was.

avatar image ScroodgeM · Aug 29, 2012 at 09:47 PM 0
Share

AngleBetween (old version) returns angle in radians, Angle in degrees

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why does the raycast hit only objects/faces of a certain rotation? 1 Answer

Problem With Raycasthit Angle 0 Answers

Average of Normals 1 Answer

raycast and trigonometry 2 Answers

Raycasting at an offset angle? 4 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges