Particle collisions with bounce and inherited velocity.
Posted 05 February 2012 - 07:47 AM
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.)
So I have all the data above, I just do not understand how I should be putting all of this together.
Any ideas, suggestions?
Posted 05 February 2012 - 08:53 AM
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.
Posted 05 February 2012 - 12:36 PM
have a look at the second example of this website, maybe that'll help you!
senior FX TD - Rhythm & Hues
Posted 05 February 2012 - 03:18 PM
Posted 06 February 2012 - 11:35 AM
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?
Cause I am using it, and it works but I am not sure if it is the right thing.
Posted 06 February 2012 - 12:53 PM
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, 06 February 2012 - 12:59 PM.
Posted 06 February 2012 - 01:10 PM
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, 06 February 2012 - 02:53 PM.
Posted 07 February 2012 - 11:49 PM
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.
Edited by vectorblur, 07 February 2012 - 11:51 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users