Jump to content

  • Log In with Google      Sign In   
  • Create Account


Collision Sliding Problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Endemoniada   Members   -  Reputation: 312

Like
0Likes
Like

Posted 29 March 2013 - 12:29 AM

[DISREGARD] I was doing something wrong so the question is invalid.

 

 

Hi guys, I'm in the process of adding sliding to my collision response and in the articles I've read they don't mention something.

 

Let's say I'm doing a sphere-wall collision, the sphere (player) moves due north and the wall's normal points due south, when the sphere hits there will be no sliding vector since the velocity and normal are complete opposites, that's fine if the guy stops moving, but if he keeps heading directly into the wall I will keep getting collisions at time zero and nothing else will happen. Even if I detect it it will cause problems if the guy keeps heading almost directly into the wall, the sliding vector will be so small that I'll keep getting collisions at such an early time resulting in the same effect.

 

I'm basically finding the first collision, moving all the objects, then looping until the time in the frame runs out.

 

Maybe I have it all wrong ?

 

Thanks.


Edited by Endemoniada, 29 March 2013 - 01:19 PM.


Sponsor:

#2 hannesnisula   Members   -  Reputation: 1010

Like
1Likes
Like

Posted 29 March 2013 - 03:15 AM

There are several different ways of doing all of this. From what I've read it seems to be common to move the objects, detect a collision then solve the intersection by moving it along a vector make the objects not intersect anymore and then apply some force/impulse to make it bounce (if that's what you want, otherwise just move them apart).

 

11t0ql3.png

 

The first circle to the left might be where the intersection is detected and the red vector is the direction it has been moving. Then moving it along the normal of the surface (green vector) it would appear sliding along this plane. This might be sufficient for your application.

 

EDIT: Just realized the image is a bit misleading. The image implies the sphere that is intersecting the plane still is moving along the red vector but my point is that it has moved along its entire vector and should only be moved "up" along the plane's normal. But the red vector is the direction it has already moved (to get to its current position). Sorry, this is perhaps quite confusing. If you have any questions about this, please ask.


Edited by hannesnisula, 29 March 2013 - 03:19 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS