# verlet question

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

## Recommended Posts

In Jakobsens paper the integration has the following line x += x-oldx+a*fTimeStep*fTimeStep; where 'a' is the force on the particle. This works if there's a force like gravity. However, if there are no forces applied to the particle then TimeStep becomes irrelevant. During collision, after I move the particles out of penetration, I'm setting the estimated velocity of my particles using something like: oldx = x - velocity; where velocity is a vector. My question is -- is this right? Should I be applying a force after collision instead of attempting to set my velocity directly? TIA

##### Share on other sites
No your doing it the right way. During collision you just move the point and then adjust the old position to match the velocity you want.

##### Share on other sites
Sort of a side point, but setting the velocity of the particles after collision in verlet is important, but it's not obvious what they should be set to, especially if you don't want to model perfectly elastic or inelastic collisions, but something inbetween.

You can find the answer here under "Use".

I developed that equation when I was working with collisions and verlet integration . This way you can set a slider between completely elastic and completely inelastic.

##### Share on other sites
numsgil, I read that article and actually implemented it to great satisfaction. Thanks, its excellent. If youre ever feeling like adding to it, the correct handling of friction would be a really welcome addition.

There is one issue that occured to me -- resolving the collision without explicitly adding or changing the velocity *still* changes the velocity in verlet. The simple act of moving the particles out of collision causes a fairly acceptable collision response. My question is, how accurate is it when this inital step of moving out of collision is combined with the changes in velocity added after. Is there a conflict?

##### Share on other sites
Quote:
 There is one issue that occured to me -- resolving the collision without explicitly adding or changing the velocity *still* changes the velocity in verlet. The simple act of moving the particles out of collision causes a fairly acceptable collision response. My question is, how accurate is it when this inital step of moving out of collision is combined with the changes in velocity added after. Is there a conflict?
;

Yes, that occurred to me to. Moving the objects out of collision actually changes the momentum of the particles. In my particular application, the result was a general increase in system energy.

The actual result is going to depend a great deal on the average object overlap. It may or may not be within an appropriate range, but you really have no way of measuring it except empiracally.
But it
However, when you are explicitly modifiying the velocity, you are actually overriding this automatic momentum change with a new one, so there is no conflict.

The only real issue I've ever encountered deals with the movement of the objects in collision (just sort of teleport out of each other) and not the momentum changes, which is what is generally considered "nice" by people working with Verlet collision response. I created an n-body simulation, where all particles are attracted towards all other particles (like a simulation of planet formation). It was hard to say for certain, but I think the collision response was creating a small but amplifyable error that eventually tore any "planets" of mine apart (they kept spinning faster and faster until the centripetal force overcame gravity).

But this effect took thousands of cycles to even be noticeable, and several more thousand before it created catastrophic failure.

Quote:
 the correct handling of friction would be a really welcome addition.

How exactly do you mean?

Collisions are generally assumed to be instantaneous, and so wouldn't be effected by friction. The trick in this case would be to find the exact time of collision and calculate the collision there. Since you 're finding the collision during specific time steps, friction (or the lack of it) can probably effect your simulation to a small degree, but I can't imagine the effect would be large even at a gross update of 10 cycles a second, let alone the 30 something that most physics runs at.

1. 1
2. 2
3. 3
4. 4
Rutin
13
5. 5

• 20
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633694
• Total Posts
3013365
×