#### Archived

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

# Collision and rotation for pseudorigid circle

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

## Recommended Posts

Hi im trying to do a 2d vehicle physics sim and have run into some problems. So far i have a rigid circle (wheel) which can bounce around due to gravity in a map made out of arbitrary line segments, but i''m having trouble with rotation. Currently my program resolves collision points by applying an impulsive force in the direction of the surface normal to the circle, changing its velocity and preventing penetration. However, since the wheel is a circle, the surface normal always points directly towards the wheel''s center of mass, which means the collision impulse cannot change its rotational speed. I think this is physically correct assuming the wheel and ground are completely rigid, but this isn''t what I want. If the outside of the wheel were rubber or something, the wheel would turn when it hits something. So my question is, how should i simulate a nonrigid collision to make the spinning work properly? Thanks for reading -InfestedFurby

##### Share on other sites
quote:
Original post by InfestedFurby
So my question is, how should i simulate a nonrigid collision to make the spinning work properly?

Add friction. Since you''re doing collisions using impulses, you can do friction with impulses too. For every normal collision impulse that you calculate, In, you calculate a frictional impulse, If, that will be tangential to your circle and act opposite to the velocity at the collision point. You need to be able to calculate the relationship between change in tangential velocity at that point and a tangential impulse. This lets you calculate the tangential impulse that would be needed to bring that point to rest (Itr). If you have to coeffitions of friction, Fs (static) and Fd (dynamic), you can calculate a tangential impulse using Its = Fs*In - this is the maximum impulse that could be generated by frictional effects. If the magnitude of this impulse is bigger than Itr, then you apply Itr (i.e. the friction) to bring that collision point to rest - so static friction. Otherwise static friction isn''t enough to bring things to rest and you use the dynamic friction: you calculate an impulse ITd = Fd * In and use that. Since Fd < Fs then this won''t be enough to bring the point to rest, and it will slide a bit.

Hope that makes sense! There are other ways to do this kind of thing (possibly simpler, though it''s not actually that complicated anyway), but what I''ve described will be really stable even for large timesteps.

##### Share on other sites
if you make your car shape out of, say 6 spheres instead of one, arranged in a box fashion, the collisions will be both, more accurate (it will be more like a box-shape), and you''ll get the angular impulse when required. you also need to consider the inertia matrix of the car, which will be a box inertia matrix, to get the proper amount of angular impulses.

you can check out this as well, although the physics is different to what you are using, it might interest you.

and this, which deals with impulses, and angular components of the velocity. This is for 3D, so it might be OTT, for things like quaternions, which are not required for 2D physics.

##### Share on other sites
Thanks guys. I tried some of your suggestions and my program is working pretty well now.

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633269
• Total Posts
3011153
• ### Who's Online (See full list)

There are no registered users currently online

×