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
1
Question by Reeceg · Nov 06, 2014 at 07:31 AM · raycastvector3

Vector3.down reverse y?

Hi, lets say Ive got a cube at point (0, 10, 0) and a Raycast going down from that cube until it hits my terrain at point (0, 0, 0) the Raycast is going down using Vector3.down. Since the Raycast is upside down is point (0, 10, 0) where it starts point (0, 0, 0) for the hit.distance so point (0, 9, 0) on the map would be point (0, 1, 0) on the Raycast point (0, 8, 0) on the map would be point (0, 2, 0) on the raycast etcetera.

Comment
Add comment · Show 6
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 b1gry4n · Nov 06, 2014 at 07:38 AM 0
Share

so whats your question?

"Vector3.down reverse y?"

opposite of Vector3.down is Vector3.up

avatar image robertbu · Nov 06, 2014 at 07:42 AM 2
Share

"so point (0, 9, 0) on the map would be point (0, 1, 0) on the Raycast point (0, 8, 0) on the map would be point (0, 2, 0) on the raycast etcetera."

Not sure what you are asking, but this is not true. If your Raycast starts at (0,8,0) for example, your hit.point will still be (0,0,0). As long as the 'y' value of the Raycast is above the terrain, you will get (0,0,0) for a Raycast at (0,?,0).

avatar image Andres-Fernandez · Nov 06, 2014 at 07:46 AM 0
Share

hit.distance gives you the distance from the beginning of the raycast to the point where the ray hits the other object. If you want the point where that hit occurs, you need to check hit.point. Check the docs here.

If your map is placed in (0,1,0) and the raycast is sent from point (0,10,0) then hit.distance equals 9. If the map is placed in (0,2,0) then hit.distance would equal 8 and so on.

avatar image Reeceg · Nov 06, 2014 at 07:48 AM 1
Share

Robertbu you answered my question I wanted to know if because the Raycast was going down would the y value at hit point be different to the map like if the x,y,z was turned upside down.

avatar image Reeceg · Nov 06, 2014 at 07:52 AM 1
Share

Thanks Andres Fernandez that helps.

Show more comments

1 Reply

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

Answer by Reeceg · Feb 03, 2015 at 11:55 AM

Not sure what you are asking, but this is not true. If your Raycast starts at (0,8,0) for example, your hit.point will still be (0,0,0). As long as the 'y' value of the Raycast is above the terrain, you will get (0,0,0) for a Raycast at (0,?,0).

-robertbu

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

28 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

Related Questions

Dynamically Change Position of RayCast 1 Answer

Moving gameobject along terrain based on player movement using raycast 1 Answer

Check if object is inside a viewing radius 1 Answer

Raycast in Direction of Input Movement 0 Answers

Raycast that follows rotation when adding a new vector 3 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