PDA

View Full Version : Object collide = particle emit @ collide?


Mr. Glass
05-04-2007, 03:50 AM
Hello. So I've got a scene with a car wreck, and a vehicle turns end over end. What I'd like to do is have particles spit from the ground when the car hits the ground (without me having to place individual particle systems).
So what I'd like to know, is if I'd have to script something to the effect of..

if 'object A' collides with 'object B' = true { colPoint = X,Y,Z of collision point;
spawn particles from colPoint;
}

or, is there a way to make something like that happen within PF's controls without scripting? And if I have to script it, can anyone suggest a site or some place where I can find examples of how to write script for a PF system? Thanks in advance for any help.

SoLiTuDe
05-04-2007, 05:21 AM
Create a pflow with as many particles as there are vertices on your vehicle... or thereabouts. Then add a position operator set to vertices, but also add a separation value. (with box 1 you just select all vertices or something), then create a deflector where the ground plane is or a udeflector for actual ground / terrain... then add a collision spawn test to the particle event, and create a new event to have them do whatever you want. :) No scripting involved... quite easy actually.

Better yet: http://www.3d-palace.com/xenomorphic/education/doc_crash_landing.htm a little more complete... quite worth the read

Mr. Glass
05-04-2007, 06:47 AM
hey thanks, that was a quick reply. I actually came up with something before checking back here, so I'll have to try the 'number of particles = to verts on object' thing. In the mean time, here's what I came up with.

http://i187.photobucket.com/albums/x201/UnrecReflect/collisionSpawn.gif

and here's a small vid

Object Collision example (http://s187.photobucket.com/albums/x201/UnrecReflect/?action=view&current=collisionspawn_01a.flv)

Mr. Glass
05-04-2007, 08:10 AM
So I've run into another problem. My previous example worked fine because there was only one object. In my scene I have many objects linked to the cars body, i.e. engine, wheels, interior, and so on. And when I add the first 'Position Object' it distributes particles over my main object (the cars body), and all over all the other objects linked to the cars body. Is there some kind of option to 'ignore linked dependents' or something like that?

OlegB
05-04-2007, 11:02 AM
You can copy car body, name it as "Body For Particles", link it as another child to the car body, select it as emitter for particles, and then hide it.

Thanks,
Oleg B.

PsychoSilence
05-04-2007, 11:45 AM
dear mr. glass! really nice set up so far. even the ground deformation (i supppose morph targets) loosk convincing to me, depending whats on the ground. sand/gravel...

i did a truck crashing down a pit shot two weeks or so for a educational film for truck drivers. what i did to turn down simulation time was to create looooow poly proxy meshes of everything needed for the particle layer. like collision objects, position objects, shape instances etc. then i linked the extrem low poly shapes to the high poly truck parts and set them to non renderable which turns out the same as oleg said. this trick turned down reactor simulation time and particle simulation time dramaticly! if you arenīt a briliant modeler like i am, iīm lousy actually...try using the optimize modifier with high enough settings to grind down the poly count but with low enough settings not to destroy the over all shape. then use an stl check if the mesh is still in tact and collapse it.

keep it simple, make it look expensive :D

kind regards

anselm

EDIT: maybe it would be nice if the gravel and sand wouldnīt stop on first collision but roll and bounce a little down the ground surface?

if you want to improve the look maybe use a scriptoperator with a script by allan mckay in the gravel event which gives a random mass to each particle. then you right click the force and set it to "Use Script Wiring". In the script wiring parameters set the "Use Script Float As" to "Influence".

on ChannelsUsed pCont do
(
pCont.useFloat = true
)

on Init pCont do
(


( -- MASS
count = pCont.NumParticles()
for i in 1 to count do

( -- mass start
pCont.particleIndex = i
pCont.particleFloat = 1.0/(random .2 1)
) -- mass end



) --border collision end

)

on Release pCont do
(
)

just some ideas on a sunny friday morning...

Mr. Glass
05-05-2007, 02:33 AM
OlegB - good idea on the body copy. I came up with something last night, kind of a backasswards way of doing it. First I re-linked all the objects I didn't want emitting particles to a dummy, added a cache to the PF, the cached out the particles. Once that was done I linked the dummy with the other objects to the car body. Once the particles are cached I can do what ever I want to the scene. Couple down sides of course, a much larger file size, and if I choose to make changes to the particles later on I'd have to unlink the dummy with the other objects. So I'll probably go back through and make a duplicate for the emitter.

PsychoSilence - The ground deformation is actually particles. It's just an instance of a rock object with a squashed scale. And I've added a couple things to my new PF. One is a velocity check which checks to emit particles only if objects are traveling fast enough. I had a funny problem where some objects that were resting on the ground where shooting particles into the air. And yes, I have added some extra influence so the particles that are flung out spin and bounce on the ground. I'll eventually add some collision detections after the particles are flung to check if they're hitting the car peices as well.

http://i187.photobucket.com/albums/x201/UnrecReflect/collisionSpawn02.gif

CGTalk Moderation
05-05-2007, 02:33 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.