Jump to content
  • Advertisement

Archived

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

youngo

collision detection wall sliding and other qs.

This topic is 6672 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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)

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!