• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Check point between two points

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2024
Messages
44
Hi, I think this is a simple problem but I haven't found a solution yet:

How can I check if a point is in a line between two points?

My spell is when a spell is cast the spell will be amplified if it detects a specific point in the line between casting position and target position.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Not sure I fully understand but maybe something like this would work:
Can you try to explain it in more detail? This sentence doesn't make complete sense to me "My spell is when a spell is cast".
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,928
Ok, let's imagine we have the points A, B and C, to check that the point B is between the point A and C you need to check that the distance between A and B plus the distance between B and C is equal to the distance between A and C, but probably you don't wanna to much precision, so instead of checking if is equal, check if the diference is lesser than some value, like 100, so the formula would be:

Code:
// Check if the point B is almost between the points A and C

abs(dist(A, B) + dist(B, C) - dist(A, C)) <= 100
 
Level 5
Joined
Feb 1, 2024
Messages
44
Ok, let's imagine we have the points A, B and C, to check that the point B is between the point A and C you need to check that the distance between A and B plus the distance between B and C is equal to the distance between A and C, but probably you don't wanna to much precision, so instead of checking if is equal, check if the diference is lesser than some value, like 100, so the formula would be:

Code:
// Check if the point B is almost between the points A and C

abs(dist(A, B) + dist(B, C) - dist(A, C)) <= 100
Ah, thank you so much I didn't come up with this at first. Since if the sum is not equal then it would form a triangle instead of a line
 
Level 5
Joined
Feb 1, 2024
Messages
44
Not sure I fully understand but maybe something like this would work:
Can you try to explain it in more detail? This sentence doesn't make complete sense to me "My spell is when a spell is cast".
Thanks, I believe your link will work. My spell intends to make players aim for specific point when cast to increase damage instead of granting a buff.
 
Status
Not open for further replies.
Top