3rd February 2003 02:08 UTC
True moving particle superscope
Pretty self explanatory. I figured it out looking at UnConeD's physics demo...don't know if he posted it yet, but...anyway, it's fully tweakable, with size, speed, and decay variables :)
Archive: True moving particle superscope
dirkdeftly
3rd February 2003 02:08 UTC
True moving particle superscope
Pretty self explanatory. I figured it out looking at UnConeD's physics demo...don't know if he posted it yet, but...anyway, it's fully tweakable, with size, speed, and decay variables :)
anubis2003
3rd February 2003 02:20 UTC
Much nicer than the normal moving particle. Follows a bit more dynamic movement. I was thinking about making one too, but since you made it first, I guess i wont.:p
dirkdeftly
3rd February 2003 02:45 UTC
Unfortunately it's about a couple thousand times slower than a regular moving particle a real estimate based on putting about 100 mp's in a preset by themselves - a rough one, but still...
Tuggummi
3rd February 2003 08:54 UTC
Yup, it moves just as s**tty as the normal moving particle :p
But a good effort :up:
btw. You do realize that those who use moving particles most likely don't understand anything about ssc coding, and those who code ssc's are not interested in moving particles anymore? :blah: :blah:
Just imagine how many n00bs would love you if they would know about this superscope? Maybe you'll include it into the Primer 2 and then all the n00bs all over the world will be bowing before you :D
Jaak
3rd February 2003 19:46 UTC
This is pretty pointless, the ssc is simple and yea U atero made it more simpel, why to make moving particle ssc if u can use just moving partycle :confused:...
OK, ok I just felt like bitching, its good ssc and now I know how moving partycel works, thanks Atero...
And Tuggummi have U ever looked at MIG-s presets... :p
dirkdeftly
3rd February 2003 20:40 UTC
as i said in #finnish-flash, the point is that moving particle isn't customizeable at all - can't do images w/out texer and even then you can't rotate them - and it's a really useful "general" effect. i'm working out making it 3D and making a decent camera movement that won't destroy the effect...keep yer pants on (please) :p
another thing is the movement is now tweakable. if you want a "ball-in-water" effect all you have to do is turn down speed, pdecay, and tdecay. if you wanted a bungee-cord effect, turn up speed and turn down dst and pdecay.
also, if you really wanted to you could pick apart and optimize the code to the point where you could have several of them bouncing off each other (if unconed ever gives us his global variables, of course)...
<edit> forgot to mention that you can now have dynamic coloring without having to use a dynamic u-tone effect list </edit>
anubis2003
3rd February 2003 22:33 UTC
You don't need global variables to have them bounce off of eachother. It's just really difficult without them. Trust me, I've tried.
jheriko
3rd February 2003 22:50 UTC
All of you out there dissing moving particle superscopes... I've been using them a lot recently, two presets in my next pack depend on them. I consider myself amongst "those who code ssc's"
And Tuggummi have U ever looked at MIG-s presets...Jack, I think that was his point....
dirkdeftly
3rd February 2003 23:08 UTC
w3rd.
btw it does require global variables once you get more than about six. otherwise you overload the superscope and, well, bad things happen.
anubis2003
3rd February 2003 23:11 UTC
Yeah, true. Man it sucks overloading a SSC.:(
AVS Axer
5th February 2003 09:17 UTC
what was that about, "if unconed ever gives us his global variables"??
anubis2003
5th February 2003 12:10 UTC
He has developed a hack that allows him to use the spectrum data for storing whatever variables he wants. In this way, "global" variables can be used, but since it is a hack, and is still developmental he doesn't want to release them.
Tuggummi
5th February 2003 14:32 UTC
Well i think we all use solid circle shapes, but when you make them rotate 3D or sync a couple of them to create a nifty pattern, is it really a moving particle anymore?
dirkdeftly
5th February 2003 16:27 UTC
...yes. the point was to copy the movement, tug, not the exact render. as you said, it'd be pointless...
anubis2003
5th February 2003 21:09 UTC
The moving particle SSC is great. Especially since it has so many customizations. Truly a wonderful particle.
jheriko
5th February 2003 23:06 UTC
Make each particle a moving sphere to make 3D particles... making them bounce off of each other shouldn't be to difficult either... I might give it a crack once I've finished J8. Its sounds like a good preset.
anubis2003
5th February 2003 23:09 UTC
Not hard??? It took me about four pieces of paper to get to the final solutions of 2-D collisions. Although, it can be done cheaply.
jheriko
5th February 2003 23:33 UTC
normal=point of collision->centre of sphere/circle, the angle between the two normals is the angle that the velocity vector must be reflected through past the normal.
anubis2003
5th February 2003 23:43 UTC
I think that might be what I did, but I'm not following exactly what you are saying. Check out my realballs.avs in the momentum question thread. The normal is the normalized distance between the two particles. You then have the tangential velocities, which are the same before and after the collision(assuming no spin). The normal velocities afterwards can be figured out using the law of conservation of momentum and kinetic energy(assuming a perfectly elastic collision). The final x and y velocities then have to be found.
jheriko
5th February 2003 23:46 UTC
the whole momentum bit lost me... you shouldn't need to use momentum unless the particles are a different mass. Get the magnitude of the original velocity and then use its direction, reflected through the normal, and multiply each of the 2/3 components by the magnitude.
anubis2003
5th February 2003 23:53 UTC
what do you mean by 2/3 components?
dirkdeftly
6th February 2003 22:44 UTC
i think two of the three components, instead of all of them...or something.
btw jheriko, they don't have to be different mass, just moving at different speeds. when a bullet hits an apple, that bullet doesn't bounce back and hit the opposite wall :)
dirkdeftly
6th February 2003 22:47 UTC
grarg, i keep forgetting to post this. this is a bunch of synced rotating 3D moving particles, along with a static object to show the rotation. i don't really like it that much, but maybe someone out there can fixify it up...
anubis2003
6th February 2003 23:27 UTC
I'm going to try to explain how it is done(this is for a generic collision in two dimensions, so certain optimizations can be made).
To start with, you must find the normal and tangential vectors for the collision. These vectors must be normalized(have a vector length of 1.0). First, you must find a vector from the center of ball A to the center of ball B.
N=B-A=(x02-x01,y02-y01)
Then you must normalize this vector by dividing it by the length of the vector(where |N| is the length of vector N).
n=N/|N|=(nx,ny)
The tangential axis t is perpendicular to n and can be found by rotating n by 90degrees. This can be easily done like this:
t=(-ny,nx)
Now that the normalized vectors are known, the components of the balls velocities can be converted to the n and t axes using the dot product(I'm going to use @ as the dot product).
Given:
vai=(vaix,vaiy)
vbi=(vbix,vbiy)
You can find the velocities in the n and t directions.
vain=vai@n=(vaix,vaiy)@(nx,ny)=vaix*nx+vaiy*ny
vait=vai@t=(vaix,vaiy)@(tx,ty)=vaix*tx+vaiy*ty
vbin=vbi@n=(vbix,vbiy)@(nx,ny)=vbix*nx+vbiy*ny
vbit=vbi@t=(vbix,vbiy)@(tx,ty)=vbix*tx+vbiy*ty
Note that these values are now scalars, not vectors. Now comes the part about momentum. I am using a coefficient of restitution(E), but for perfectly elastic collisions, E is 1. Also, optimizations can be made if the masses are the same(Just set them both to one and simplify).
vafn=(mb*vbin*(E+1)+vain*(ma-E*mb))/(ma+mb)
vbfn=(ma*vain*(E+1)-vbin*(ma-E*mb))/(ma+mb)
Now, since all of the force acts along the normal axis and none along the tangential axis, the tangential components will be the same before and after.
vaft=vait
vbft=vbit
Now the final velocities need to be rotated back into x and y components.
vafx=vafn*nx+vaft*tx
vafy=vafn*ny+vaft*ty
vbfx=vbfn*nx+vbft*tx
vbfy=vbfn*ny+vbft*ty
That's it! A big thanks goes out to Andre LaMothe for his book Tricks of the Windows Game Programming Gurus and my physics teacher Mr. Plucinski. I'll try to make a diagram if any of you feel like you need it.
P.S. Was this confusing? It was for me. Ask me if you have any questions.
Fork me on GitHub