I have been stuck at this problem for at least 3 weeks. And what I’m trying to do is to determine whether a point is lying on two points (Point A, Point B – will use this 2 points to form a line). Then, I will use the mouse click event to capture Point C.
I have tried using the pointA and pointB to form an equation (y=mx+b), then I substitute the pointC into the equation. By right if the point is between pointA and pointB, it should return true. But sometimes, this method is not working.
Does this have to be done with math? considering this is a game engine you could be using objects and tracing between A and B to see if they intersect an object C in the middle.
this is not necessary to be done with math. But I don’t know how to do it in another way. Can you tell me more about how to use objects and tracing in this situation?
For any future readers, you can detect whether point C lie on the line AB by getting the dot product between the AB vector and AC vector, it should result 0.