Jump to content

Particle collisions with bounce and inherited velocity.


Symbolic

Recommended Posts

Hi,

For a while I have been trying to make my own particle collision system for POPs. I would like to manipulate the ACCEL instead of velocity and I am aware that updating ACCEL will give me softer results, meaning there will always be a bit of lag as the forces get updated.

I have many bits and pieces already working, so I am already using the required building blocks, "volume samples", "volume gradients" and some other attribute stuff related to proximity to volumes etc. So technically I am at a good position, the main part that I can not get working (or at least I am not %100 that it is working) is the part where we put all the vectors together, this being:

1) The vector of the velocity of the volume. (Inherited velocity, relative velocity?)

2) The vector of the particle's current velocity.

3) The vector of the force that will keep the particle outside of the volume. (Push force.)

etc.

So I have all the data above, I just do not understand how I should be putting all of this together.

Any ideas, suggestions?

Thanks!

Link to comment
Share on other sites

Hello,

Just to make it clear:

I am more after the logic and the correct ways of calculating "Tagential" and "Normal" vectors, based on the particle's and the volume's velocity. And then I will be updating my ACCEL with the resulting vector.

Thanks.

Link to comment
Share on other sites

The volume gradient is the vector pointing to the boundary of the volume. So if you collide with that you can easily find the distance to if if you have an sdf: just the voxel value. Using accel will act as a force if you multiply it by the mass of the particle.

Link to comment
Share on other sites

Hello Macha, thanks for the link. It is a good site in general, I am already using similar approaches, with some extra bits and pieces. The main question is, for example "How we calculate a relative velocity?" or "Is it called Relative Velocity?" at first place.

For example in a case where we have a box travelling from A to B and a particle travelling from C to B. And when they collide at some point what exactly is happening? The aim is that the particle picks-up a bit of the velocity of the box and slightly change its direction... What is the maths behind that?

Is it this?

http://en.wikipedia.org/wiki/Relative_velocity

Cause I am using it, and it works but I am not sure if it is the right thing.

Thanks.

Link to comment
Share on other sites

I'd say just add the two velocity vectors. If you want to adjust bounciness then normalize the resulting vector and multiply by a scaled down version of its original length.

Edit: wait, thats wrong. Errr, use the resulting vector as an input in the reflect vop? Dont have H now, so I cant try it. You need some sort of normal for that and I guess its either v or the two added v.

Edited by Macha
Link to comment
Share on other sites

It is described further down the page here: http://en.wikipedia.org/wiki/Elastic_collision

Actually try the following. I think that may work. Subtract both particles position and use the resulting vector in a reflect node, one for each particle, with v being the other vector.

For the velocities to stay correct however you must conserve kinetic energy. So, 0.5*mass*speed^2 as a sum of both particles has to remain the same. But, uhm, not sure how. Just rearrange the equations perhaps. You may be able to fake but just keeping it under that known limitation.

I have a feeling vectorblur might know more about this. Right?

Edited by Macha
Link to comment
Share on other sites

Hi macha, i missed this one completely.

I guess symbolic has found the answer in C# code on wiki link you posted.

I like the idea of the code. how it uses vectors rather trig which almost always involve square roots and angles to make things little messy.

Relativistic motion is the key here as just by subtracting one velocity from the other we can make the other object look like stationery.

Einstein is our dear friend but he did spoil newton's party. ;)

For elastic collisions, respecting the conservation of energy / momentum. assuming particle A with mass M1 , velocity Va and particle B with mass M2 , velocity Vb.

We have :

1/2 M1Va^2 = 1/2M1Va'^2 + 1/2M2Vb^2

Though my understanding is very elementary on mechanics, as things go very complex very quickly.

But this one is more of a algebraic manipulation, so being careful if we can represent m1 and m2 as a ratio and split velocities in normal and tangential components and knock off tangential velocities as it wont change.

We could have 2 equations in unknowns for our normal velocity after the collision.

Solving it with substitution in the momentum equation, we will end up with a quadratic equation.

Now i don't know if that can be nicely factorized but that's something which needs bit of hair pulling over the weekend.

Factorization is always hard and i did not like it in school either.

Once we have the factors we are done. one of the roots will be what we are looking for.

I will have a go at it over the weekend and check it. :)

Cheers,

Edited by vectorblur
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...