Original Post
Hey guys. I've been having a little difficulty getting my head around collision detection. I thinking perhaps moving point/triangle intersection would be the most appropriate method to use to test if a sphere is intersecting with what is essentially a plane with square holes in it. The holes are 2cm by 2cm and the spheres are 3cm by 3cm, so the idea is that a sphere can only partially sink in to the hole if it's resting on it. The spheres are also going to have to collide with each other and a bounding cube that surrounds the environment.
As the title suggests, I'm thinking moving point/triangle intersection might be a good idea for this as I have some notes on how that works, I've been looking through the maths and I'm having some difficulty understanding what's going on.
Basically, I have this to contend with:
Where the triangle is defined by points p1, p2, p3
The sphere starts at q0, moving to q1 in the time interval [0,1], i.e. assume unit time step, dt=1
q(t) = (1 - t)q0 + tq1 //ok, I get that. It's the path of the point
p(u,v) = p1 + u(p2 - p1) + v(p3 - p1) (1) //what the hell are u and v in this context? (they're actually alpha and beta in the source I'm using) . I'm aware I'm supposed to plug in t from later to get them, but how?
simultaneous equations?
u, v >= 0
u + v <= 1
and
(1 - t)q0 + tq1 = p1 + u(p2 - p1) + v(p3 - p1) //ok, so if the result of this is in the range of 0 - 1, there's a collision
n = (p2 - p1) x (p3 - p1) //I can only assume 'n' is the normal to the triangle
:.
((1 - t)q0 + tq1).n = p1.n //and plugging the result of t from thisin to (1) is supposed to give these mystery u and v values. Great!
So basically my question is; what the hell are u and v?
As the title suggests, I'm thinking moving point/triangle intersection might be a good idea for this as I have some notes on how that works, I've been looking through the maths and I'm having some difficulty understanding what's going on.
Basically, I have this to contend with:
Where the triangle is defined by points p1, p2, p3
The sphere starts at q0, moving to q1 in the time interval [0,1], i.e. assume unit time step, dt=1
q(t) = (1 - t)q0 + tq1 //ok, I get that. It's the path of the point
p(u,v) = p1 + u(p2 - p1) + v(p3 - p1) (1) //what the hell are u and v in this context? (they're actually alpha and beta in the source I'm using) . I'm aware I'm supposed to plug in t from later to get them, but how?
simultaneous equations?
u, v >= 0
u + v <= 1
and
(1 - t)q0 + tq1 = p1 + u(p2 - p1) + v(p3 - p1) //ok, so if the result of this is in the range of 0 - 1, there's a collision
n = (p2 - p1) x (p3 - p1) //I can only assume 'n' is the normal to the triangle
:.
((1 - t)q0 + tq1).n = p1.n //and plugging the result of t from thisin to (1) is supposed to give these mystery u and v values. Great!
So basically my question is; what the hell are u and v?