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 KoningStoma · May 01, 2013 at 01:08 PM · vector3vectorvector math

Vector math problem

I have two vectors (a and b) and an up-vector, which can point in any direction. I need to find the distance between A and B, but only the distance from the perspective of the up-vector (D). So without the distance seen in the side view (C).

How do I do this? I don't know where to begin.

alt text

Comment
Add comment · Show 3
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 fafase · May 01, 2013 at 01:13 PM 0
Share

Have you tried to ignore the third dimensions?

avatar image KoningStoma · May 01, 2013 at 01:17 PM 0
Share

I have thought about it, but that would cause problems, because the up-vector can point in any direction.

I basically want the 2d distance, between 3d points, with the up-vector being the normal of the 2d plane.

avatar image fafase · May 01, 2013 at 03:29 PM 0
Share

$$anonymous$$mm, one thing you could try is to use A dot up and B dot up.

This will result in the length of the projection of A onto up and the length of the projection of B onto up. Then comparing those two length you may get what you need. Not sure though.

1 Reply

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

Answer by robertbu · May 01, 2013 at 01:17 PM

You can project the two points onto the plane defined by up-vector and common vertex of the three rays. You can find a script with many 3D math routines including projecting a point onto a plane here:

3D Math Functions

Comment
Add comment · Show 4 · 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 fafase · May 01, 2013 at 03:58 PM 0
Share

But which one is the answer? There are dozens of methods on the link you provide.

avatar image robertbu · May 01, 2013 at 04:00 PM 0
Share

I'm not sure why someone converted my answer to a comment. What you want is exactly as I describe. The math script at this link contains a ProjectPointOnPlane(). The plane is defined by the up vector and the common vertex point. Project A and B onto the plane and then get the distance.

avatar image robertbu · May 01, 2013 at 04:06 PM 0
Share

@fafase - ProjectPointOnPlane().

avatar image KoningStoma · May 01, 2013 at 05:11 PM 0
Share

Yeah, this was exactly what I used and needed. Thanks.

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

13 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

Related Questions

Change direction of vector based on which way player is facing 1 Answer

How to visualize Vector math in Unity? 1 Answer

How do I make an array of vectors? 1 Answer

Can't change vector direction 0 Answers

How to change Point of Application of a vector? 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