Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
6
Question by remi · Aug 12, 2010 at 09:25 PM · vector3

create a vector from one point to another point ?

hello,

I just want to create a vector3 (direction) from two points (world position)! a idea ?

thank you

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
28

Answer by Brian-Kehrer · Aug 12, 2010 at 09:39 PM

Vector3 newVector = targetPoint - initialPoint;

or

Vector3 newVector = targetTransform.position - fromTransform.position;
Comment
Add comment · Show 1 · 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 remi · Aug 12, 2010 at 10:04 PM 0
Share

AH! simply ... thank you remi

avatar image
8

Answer by darbotron · Aug 12, 2010 at 10:41 PM

the only thing you need to rmember when doing vector subtraction is that, like all subtraction (i think!), it's non-commutative (i.e. in order to get the answer you want from subtraction it matters which thing you subtract from which).

I remember it like this:

vSourceToDestination = vDestination - vSource;

That's more or less exactly what the previous answer says, but I'm hoping my "destination minus source" thing helps it stick in yr head :)

darbotron

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 UrielKane · Jun 25, 2016 at 08:28 AM 0
Share

Thanks that's really solve my problem. I was substracting in an inverse way, so that's why the direction wasn't working until i read this.

avatar image Bunny83 · Jun 25, 2016 at 08:37 AM 0
Share

The rule is know as the head-$$anonymous$$us-tail rule

avatar image Westeye · Aug 11, 2016 at 05:42 AM 0
Share

Thank you for this explanation, I easily solved my problem after reading this.

avatar image Bunny83 Westeye · Aug 11, 2016 at 08:48 AM 0
Share

This is more commonly known as Head-$$anonymous$$inus-Tail rule

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Input.GetAxis("Horizontal") problem 3 Answers

Rigidbody + Vector3 3 Answers

Vector3.lerp doest work 1 Answer

How to make Vector3s communicate with Floats? 2 Answers

Vector 3 do/while problem 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