float x,y;
Vector v;
int j;
for ( j=0; j<iParticles;j++) {
tParticle *p1;
p1 = particles[j];
x = p1->m_x.x;
y = p1->m_x.y;
if ( x <= 0 || x >= SCREEN_W - 1) {
v = p1->m_x - p1->m_oldx;
v.x *= -1;
p1->m_oldx = p1->m_x - v;
}
if (y <= 0 || y >= SCREEN_H - 1) {
v = p1->m_x - p1->m_oldx;
v.y *= -1;
p1->m_oldx = p1->m_x - v;
}
However when a only one particle within a system collides the particle starts jumping and "gets stuck" in the wall.
You can see the attached exe http://s3.youshareit.com/download.php?03cae6ed449f4ad83e3a7815e48dadd5 (Scanned with AVG Free)
I will be very greatful if anyone can help me
Thanks in advance!
PS: If anyone can suggest me an article about verlet integration and collision that would be awesome too!
Need help, verlet and colisions with bounding box
Hello.
I've got my whole system working fine, however there is a problem with the colisions. What I'm trying to do is just some basic string system collisions with the screen ("bounding box"). It seems to work but not quite.
This is what my collision code looks like:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement