Friction... (2D physics)
I just implemented linear friction into my 2D physics engine like this:
I take the velocity-components of two colliding bodies, which are parallel to the collision tangent, scale them down a bit and subtract them from the original velocities. The result is quite satisfying...except for a nasty problem that occurs now! :-(
There's a strange "sliding" problem. Here's the two demos (seeing things in motion is better than a thousand words) ;-)
Click me!
See what I mean? Since the box stops sliding to the right, but still spins it just falls down where it is...
Now my question: Did I do something wrong with linear friction? Or is only the angular stuff missing? ???
Thanks a lot for your help!
again and again ;-)
Oops, sorry! I forgot to display the controls ;-)
Press BACKSPACE to switch between timesteps / realtime mode
(RETURN proceeds a step)
Press BACKSPACE to switch between timesteps / realtime mode
(RETURN proceeds a step)
I think there is a big problem with how your executables work on other people's PC since you switched to DirectX (if I remember correctly you first posted OGL demos). It used to work with GL but your DX demos would output very tiny lines and I put it on Wine failing to emulate some DX features but I get the same result in VMWare so it might be with your code after all.
Here's what I get both with Wine and VMWare (can't reboot right now for confirmation on the real thing sorry):
Here's what I get both with Wine and VMWare (can't reboot right now for confirmation on the real thing sorry):
Huh? Looks all pretty good on my machine :-(
I'm new to DX, so I'm not quite sure how to fix this...can ANYONE see something? ;-)
I'm new to DX, so I'm not quite sure how to fix this...can ANYONE see something? ;-)
Quote:Original post by VanKurt
Huh? Looks all pretty good on my machine :-(
I'm new to DX, so I'm not quite sure how to fix this...can ANYONE see something? ;-)
But what I see is not what's supposed to be on screen right? :)
Quote:Original post by VanKurt
Nope, those lines are actually boxes ;-)
Works fine under native Windows :) so no problem with your code.
It's looking good! You finally sorted out the impulse problem.
I'd say the friction is not working, and when it seems to be it's just luck. I suppose this is impulse based so what happens if you completely cancel the tangential component of the impulse in your no friction code? This should give you full friction, even too much friction but that's a start... something like J = normal * J.Dot(normal) should do it.
edit: Seeing how well your no friction code works the problem is more likely to come from your friction code. The rigid body part looks fine.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement