Advertisement

Collision Detection

Started by June 23, 2000 06:40 PM
2 comments, last by rockslave 24 years, 6 months ago
How to know the smaller distance between a line segment and a point? I need it to make my collision detection! Thanks, Arthur(rockslave)
import money.*;#include "cas.h"uses bucks;
ola!
first, you get one point from the line segment (one of the extremes).
then you get the vector that goes from that point of the line segment to the other point you want to know the distance(let''s call it a).
now you make the projection of that vector over the line vector.
(call it b)
know you use h^2 = c1^2 + c2^2, where h is the length of a and c1 is the length of b.
c2=sqrt( h2^2-c1^2 )
Advertisement
Ha! Será que podemos falar português nesse forum? Obrigado pela esplicação! Vou copiá-la e estudá-la em casa! Valeu!

Thanks, Arthur(rockslave)
import money.*;#include "cas.h"uses bucks;
Sim. Eu so pensei q pudessem reclamar com a gente por estar-mos a falar portugues. A maior parte do pessoal so fala ingles!

This topic is closed to new replies.

Advertisement