thanks for replying.
I am after just a basic first person shooter sort of collision response ( slide along walls, get over small obstacles and so forth), so I'll leave dynamics for later.
[as explained here: [HTML][http://www.peroxide.dk/download/tutorials/tut10/pxdtut10.html[/HTML]](http://www.peroxide.dk/download/tutorials/tut10/pxdtut10.html[/HTML])
I was thinking about using a step variable ( time delta ) indeed to grab the difference between collide-position and last-position( before collision ) and normalize and invert that , so to move the moving ball away from the collision point ( no dynamics involved ).
So here is basically what I would like to do :
//compute a simple collision response.From VCOLLIDE demo
void ComputeResponse(Vector normal, Vector v, Vector *new_v)
Vector v_normal = normal*(v/normal);
Vector tan = ((normal*v)*normal);
Vector v_tan = tan*(v/tan);
*new_v = v_normal*(-1) + v_tan;
//something to move ball .5f along normal away from collision point
for (int j=0; j<no_of_colliding_pairs; j++)
cout<<"Detected collision between objects "<<vcrep[j].id1<<" and "<<vcrep[j].id2<<"\n";
polyObject *p1 = GetObjectWithId(vcrep[j].id1);
// polyObject *p2 = GetObjectWithId(vcrep[j].id2);
normal = p1->position[step] - p1->position[oldstep];
ComputeResponse(normal, (p1->v), &(p1->v) );
What I am doubious about is the step function..
But I guess this would suffice:
In initialization part ( int main):
step = 0;
In callback function :
step = oldstep;
step = step+1;
maybe after rendering frame I should call :
oldstep = step to update not sure.
What I've been figuring so far is to put the collision callback inside a void function so that when it gets called in the main callback I get a collision condition each time balls collide instead of a matter of fact ( balls collide constant ).
I am just a newbie with c++.