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 kag359six · Jun 24, 2013 at 10:03 PM · vector3vectorvector math

How to visualize Vector math in Unity?

I'm trying to visualize solving these issues with vectors, such as the dot product. I just can't seem to visualize the position of gameObjects as quantities with a direction. If I wanted the Dot Product of an object at (2,4,0) and another object at (5,2,0), how can I draw that out on paper with the direction?

Comment
Add comment · Show 1
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 donutkeith · Jun 24, 2013 at 10:15 PM 0
Share

I don t understand what you mean. So I'm not going to put this as an answer but maybe this will help you. A dot product has no direction it is just a scalar number that represents the sum of the products.

I think position and direction are also different. I could be wrong but position (x,y,z) is (number of units in the x, # of units in the y, # of units in the z) away from origin (0,0,0). Direction (x,y,z) would be adding (x,0,0) + (0,y,0) + (0,0,z).

So in your example (2,4,0) as a position is 2 units away from origin in the x axis and 4 units away from the origin in the y axis. So in unity this object would be in the center of your world but off to the right 2 and up 4 (I think not 100% if + is right or left, guess it depends on which way your looking).

(2,4,0) as a direction is a vector {square root of([2^2]+[4^2]) = (4+16) = 20} in magnitude and points up mostly. Draw a vector with the tail starting from origin pointing 2 in the +x direction and a vector with the tail starting at the tip of the previous vector to 4 in the +y direction then draw a line from the origin to the head of the last vector.

1 Reply

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

Answer by s_guy · Jun 24, 2013 at 11:20 PM

The language you use in your question I think is complicating things. A vector3 can represent an object in r3 space, but usually with dot products it helps to think of it as an actual vector (the physics concept, not the data structure).

That is, the vector you're using in a dot product conveys a direction and a magnitude, not just an x,y,z value in r3 space. Think of it as the line from 0,0,0 to the position of that x,y,z position. The magnitude is just the length of this line. This makes adding, subtracting, and more complex operations much easier to visualize.

"If I wanted the Dot Product of an object at (2,4,0) and another object at (5,2,0), how can I draw that out on paper with the direction?"

  1. Draw a line from 0,0,0 to 2,4,0. Call it 'a'.

  2. Draw a line from 0,0,0 to 5,2,0. Call it 'u'.

  3. Draw the projection of line a onto line u, as depicted here (this image doesn't use the exact coordinates from your example).

alt text

Think of it as "how far the first vector goes in the direction of the second vector". Note that this means a.u is different than u.a.

Practical uses:

  • quantity is positive if the two vectors are pointing in similar directions (acute angle)

  • quantity is zero if they are perpendicular (on any plane)

  • quantity is negative if the two vectors are pointing away from each other (obtuse angle)

Unity's official docs were a good, brief refresher course for me on this. http://docs.unity3d.com/Documentation/Manual/UnderstandingVectorArithmetic.html

For a deeper study, the Kahn academy videos on this are excellent. They can be a little more "abstract math" oriented, but he does a great job of walking through vectors, vector math, and how to gain an intuitive sense of vector math, i.e. what a vector operation "means". https://www.khanacademy.org/math/linear-algebra/vectors_and_spaces

You can jump straight to his lecture on vector dot product and cross product intuition, but I advise building up to it. https://www.khanacademy.org/math/linear-algebra/vectors_and_spaces/dot_cross_products/v/dot-and-cross-product-comparison-intuition

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

16 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

Related Questions

Vector math problem 1 Answer

Change direction of vector based on which way player is facing 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