collision detection

Particle Collision Help

mst1228's picture

Hello,

I am trying to obtain something similar to the application in the video below:

http://vimeo.com/9022191

Right now, I'm focusing on just the particle system and collision with the logo. I've attached a VERY basic example of what I am having trouble with. (You might need to change the path to the 3d object in the composition after opening, it is currently a direct path on my local file system.)

I have a couple of questions at the moment: I have successfully loaded the 3d object and created the particle system and setup the 3d object to be a collision object with the particle system. However, it seems like the particles are colliding with the object much to early. Almost as if the object was higher on the screen than it actually is. Any idea why that might be happening? The 3D object used for collision is a .stl file I exported from Google SketchUp.

Secondly, is it possible to have the particles collide with themselves? I haven't tried using 3d objects as particles, but maybe that could be something?

Sometimes the particles go behind the 3d object altogether. Do I have to change a Z location value somewhere that I'm missing?

Finally, I have concluded that the final objective really doesn't have anything to do with 3D. It will be a 2D plane, and perhaps the same goal could be accomplished much easier a completely different way.

Any help would be appreciated, Thanks so much.

Open CL 3D Vertex Collision (hit testing) (Composition by dust)

Author: dust
License: MIT
Date: 2010.07.28
Compatibility: 10.6
Categories:
Required plugins:
(none)

so my daughter loves this ipad game "angry birds" its a tower defense type of game in 2d. probably made with something like cocos2d or unity3d with no z depth. so i decided to see if i could wip up something in an evening similar but in unity 3d using forces etc...

well i accomplished that task as unity3d makes things like physics very simple. i began thinking how hard would it really be to do something similar in QC. thinking i would start with a box2d approach and track vertex positions of sprite or something. i dug out some 2d fluid texture maya mel scripts and thought it might be possible to calculate a collision by converting UVs to pixels space and evaluating a hit based on texture data in realtime.

i pondered on this idea for a bit and then said to my self why not just check all the vertex points (xyz) for equivalence using the size of a model as a threshold. so using the handy get component mesh tool, i simply iterated through all my vertex's and conditionally checked x,y,z on each vertex until the two models collided. so this was fairly simple could have been done in java script instead of an iterator. unfortunately the frame rate for comparing two models with a vert count of 420 was only giving me around 30 fps on my machine. which is decent and i was happy with the fps as i could check for collisions and then apply forces based on those collisions etc.

still 30fps with only two low poly count models wasn't cutting it as quartz has all this open cl multi-threaded stuff that was built for this type of thing so i decided open cl was going to be the best way to detect if two models collide in QC.

so at first i thought i would just break down and iterate through two sets of vertexes checking for hits like i did before but after looking at the openCL reference guide and noticing all these sweet matrix and math stuff built in. i figured i could just use a distance function and check for when the models where within the threshold of there respective scales to detect a hit. so this was a different approach to the same problem. the results are similar but by doing this in on two different threads in parallel i was able to get my fps up over 100 at times in just a few lines of code.

so both these patches work for hit testing in 3d with rotations etc.. i still need to do some more testing and get a vertex by vertex comparison made in open cl instead of distance function so that eventually i may be able to do some rudimentary physics calculations with inertia and forces etc..

i don't know if this will help anyone but could be used to make a simple shooter type of game or projectile / target type of thing in 3d with your own models.