collision detection wall sliding and other qs.

Started by
3 comments, last by youngo 23 years, 10 months ago
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?
Advertisement
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)
import money.*;#include "cas.h"uses bucks;
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.
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





won''t the object slide on the wall in varying distances if the velcotiy of the object is not constant?

This topic is closed to new replies.

Advertisement