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 jakovd · Jan 07, 2015 at 02:11 PM · raycastplane

Help me understand the distance parameter in Plane constructor

I can't understand why there is a difference in using this two ways for constructing the plane.

 var plane = new Plane(Vector3.Up, new Vector3(0f,0.2f, 0f);

and

 var plane = new Plane(Vector3.Up, 0.2f);

I want to get a plane that is parallel to XZ plane and 0.2 higher (y=0.2f). The first constructor does this nice, but why is the second approach giving different results? I'm doing some raycasting to that plane and the second plane gets hit somewhere under XZ plane (y values are <0) The first constructor uses two parameters: normal vector and point through which the plane goes through. The second constructor uses also normal vector but the second parameter is float distance. What distance? Only thing I can think of is distance from the origin (0,0,0) and I think that would mean in the direction of the normal vector. Did I misunderstand this?

Comment
Add comment · Show 2
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 jakovd · Jan 07, 2015 at 03:32 PM 0
Share

Yes, that seems to be the right, thank you. Still, it does not make sense to use the value in the opposite direction. Using negative value for distance does not sound right to me.

avatar image Victory Dan Greene · Jan 07, 2015 at 03:41 PM 0
Share

You might think about it like this: say you are at the origin, and you want to create a plane to look at. If you want the plane to face you, it has to be offset from you in the direction opposite its normal.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Victory Dan Greene · Jan 07, 2015 at 02:48 PM

It seems the plane is constructed using a point distance units from the origin, as you expected, but in the direction opposite the normal.

If you use...

 var plane = new Plane(Vector3.Up, -0.2f);

...does it do what you want?

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

26 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

Related Questions

Find TextureCoordinates from plane with out raycast only using mouse position on plan 0 Answers

Top down look rotation snaps when looking left, right, and back 1 Answer

rotate towards a raycast hit point 2 Answers

RayCast Help 1 Answer

Screen point to point on Plane WITHOUT Raycast? 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