Jump to content

[1.8] Getting a Vec3 directed towards an entity?


Ferrettomato

Recommended Posts

Hi

 

For background info it might help to find an online introductory course into vector maths, just the simple stuff like adding & subtracting vectors, length, multiplying by a length, calculating angles between them, that sort of thing.  A lot of minecraft stuff is based on vectors...

 

The short answer is-

 

deltaVector = targetPositionVector - originPositionVector

 

targetVector is the entity being looked at.

 

for example

Entity1 = origin = located at [5, 4, 3]

Entity2 = target (being looked at) = located at [10, 11, 1]

the vector pointed from Entity1 toward Entity2 is

[10-5, 11-4, 1-3] = [5, 7, -2]

 

-TGG

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.