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 Mitch Wardle · Apr 01, 2014 at 11:03 AM · javascriptscript.vector

I don't understand Vector2 + Vector3

If anyone could help me understand Vectors that would be great as I want to create a 2d platformer with cubes. I'm quite knowledgeable with javascript but when I watch and read tutorials, they use vectors to create a jump script and a good movement script. But I don't understand how vectors work and what they are for, if anyone could leave a detailed explanation or video tutorial on how to use vectors in unity3d that would be great. Thanks.

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 AlucardJay · Apr 01, 2014 at 12:41 PM 0
Share
  • http://docs.unity3d.com/Documentation/$$anonymous$$anual/VectorCookbook.html

  • http://docs.unity3d.com/Documentation/$$anonymous$$anual/UnderstandingVectorArithmetic.html

avatar image knapeczadam · Mar 13, 2018 at 09:42 PM 0
Share

https://github.com/knapeczadam/Unity-Vectors

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by POLYGAMe · Apr 01, 2014 at 07:58 PM

A Vector2 stores two floats, one for your X position and one for your Y position in cartesian coordinates. A Vector3 adds the Z position.

Say you wanted to move your character along the x axis. You can simply access the player's x value. You could do this with transform.Translate(5,0,0), where the character will move at a speed of five along the x, or you could access the x variable inside the transform.position Vector3 : transform.position.x += 5. Obviously you'd want to use time.DeltaTime and magic numbers are a no go but basically a Vector2 or a Vector3 are just two or three floats in one easy to manage variable :)

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
avatar image
0

Answer by senc01a · Apr 01, 2014 at 12:39 PM

The concept of vector is broader than Unity in fact it comes from mathematics, usually studied in the early years of high school.

I recommend you to have a look at this video What are Vectors, where you can find information about what they are and some of their operations (addition, product, etc). Please also check this website, Vectors for beginners, which I believe will clarify most of the questions you have at this stage.

2D and 3D vectors are essentially the same, only that 2D vectors only have 2 components (x,y), while 3D vectors have 3 (x,y,z).

In Unity you will be mostly working with 3D vectors as the space is three-dimensional. However, all of the operations apply to both type, and are similar.

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
avatar image
0

Answer by T27M · Apr 01, 2014 at 12:38 PM

Vectors aren't Unity specific.

Search engines are your friend.

Vectors Third Party

Unity Learn Primer

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

25 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

Related Questions

Why is this boolean value changing? 3 Answers

Comparing vector 3 locations 1 Answer

Teleport to where I click 2D 2 Answers

Lives aren't subtracting, going straight to game over. 2 Answers

Flip over car after tips over? 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