Archived

This topic is now archived and is closed to further replies.

youngo

collision detection wall sliding and other qs.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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





Share this post


Link to post
Share on other sites
won''t the object slide on the wall in varying distances if the velcotiy of the object is not constant?

Share this post


Link to post
Share on other sites