Jump to content

Recommended Posts

Posted

I'm trying (and failing) to get a Vec3 that's pointed towards an entity from another entity's perspective, without bringing its look vec in to consideration. This is probably really simple, but I can't figure it out. How?

Posted

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

 

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.