• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Check point between two points

Level 4
Joined
Feb 1, 2024
Messages
41
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 65
Joined
Aug 10, 2018
Messages
6,647
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,853
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 4
Joined
Feb 1, 2024
Messages
41
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 4
Joined
Feb 1, 2024
Messages
41
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.
 
Top