collision detection wall sliding and other qs.
how do you slide against a wall if you collide with it at an angle? do i just make the velocity vector perpendicular to the wall vector?
If it''s a ball, for instance, the out angle is equal to the in angle, but to the other side. Is this what you meant?
Thanks, Arthur(rockslave)
Thanks, Arthur(rockslave)
See the Glide/DX/OGL fourm. It has a little thing on 3D collision detection. If it''s 2D then you''re gonna have a hard time.
------------------------
Captured Reality.
------------------------
Captured Reality.
here is how i do it
say , you are moving a dot around at px,py , angle
you have just colided w/ the wall
void blafunct(void)
{
float, px=something,py=something else,angle=an angle;
float tempx,tempy;
tempx=px;
tempy=py;
tempx+=cos(angle);
tempy+=cos(angle);
if( px,tempy has not collided with wall)py=tempy;
if(tempx,py has not collided with wall)px=tempx;
}
put this in your loop
see if this works
-Infested Furby
infestedfurby.cjb.net
say , you are moving a dot around at px,py , angle
you have just colided w/ the wall
void blafunct(void)
{
float, px=something,py=something else,angle=an angle;
float tempx,tempy;
tempx=px;
tempy=py;
tempx+=cos(angle);
tempy+=cos(angle);
if( px,tempy has not collided with wall)py=tempy;
if(tempx,py has not collided with wall)px=tempx;
}
put this in your loop
see if this works
-Infested Furby
infestedfurby.cjb.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement