Spark movement in car crash?

Started by
10 comments, last by OldProgie2 13 years, 9 months ago
Hi all,

I've been trying to write a spark system for car crash. Something I would love to achieve is similar to this video:



I have the particle system ready but I can't get the movement of the spark to work. I notice some time the spark moves forward, some time it moves backward, then other time it just flies everywhere.

Also, how do you get the streak effect for the spark? I have a dot texture and I stretch it out but I'm not sure that's the best solution.

All inputs are greatly appreciated. Thanks.

[Edited by - b_thangvn on June 30, 2010 8:22:57 PM]
Advertisement
Quote:Original post by b_thangvn
I have the particle system ready but I can't get the movement of the spark to work. I notice some time the spark moves forward, some time it moves backward, then other time it just flies everywhere.

Also, how do you get the streak effect for the spark? I have a dot texture and I stretch it out but I'm not sure that's the best solution.


I _think_ that the spark movement is a combination of car and, possibly, camera movement.

As for the streak effect, how do you stretch it? Last position and current position?
Hi Bangladesh,

For the stretching, yes, new pos - old pos.

Can you elaborate on the the car movement + camera movement? I'm working on the emitting angle but haven't found a good way for all the situations.
A spark is actually just a point source of light (a glowing particle), but it appears as a line to the observer due to persistence of vision.

Therefore, if you want to model it correctly you should track it's position 'on screen' as would be viewed by the camera, then stretch this point across several of those positions. E.g p[t], p[t-.02ms], p[t-.04ms], ...

Just be aware though that there is a theatrical element to this. Sometimes although physically correct, it just won't 'look' right and you may want to modify the spark trajectories to get the look that you feels right or is the most dramatic.
Hi OldProgie2,

Thanks for your input. I do transform my particle position into screen space and perform the scaling calculation. However, doing these give me a problem with car crash at high speed versus low speed. I want spark to be short on low speed impact, and long streak on high speed impact. Right now I don't really have a good way to do this.

Also for the movement: I model gravity and dragging correctly, but having trouble with emitting angle. Right now I just emit the particle backward at high speed and straight up at slow speed, but it doesn't look great.

Here is a pic of what I'm at:



Thanks for your help.
Some physic engines give you the normals of the contact between coliding objects. Using such kind of info you should be able to find the direction to emit your particles

I think it would be easier to tell you what's wrong with a video ;-)
Noxis - <a href="www.sonixengine.com>Online protfolio
Hi Noxis,

I do be able to get the normal at the collision point, but having trouble to use it to get the right emitting angle.

I'm afraid I can't make a video since the game isn't my properties :(. Do you know any good way to do this, or maybe you know some good source that provide this info ? Thanks.
Intriguing problem.

I have an idea: Ask yourself, how the particles come into being, physically. Two bodies hit, and on the spot they hit particles are torn off from either body. How fast can these particles become and what direction can the have ?
Imagine holding a nail against a grinding machine. Pieces torn from the nail fly in the same direction as the local velocity of the machine where the nail touches it. So this gives you a general direction.

How is that direction calculated ? It's not the contact normal, but you need the latter to calculate it. I think what you need is the planar velocity, i.e. the velocity of the contact point projected to the plane defined by that normal.

Note that I mean the relative velocity, but for a start we can idealize and look for instance at a car streaking a (static!) wall with one of its sides: The contact normal is the walls normal, the contact velocity is more or less the cars current velocity. This projected to the wall plane gives again more or less the same.

Now: The maximum velocity of the emitted particles is IMHO about twice the magnitude (I just remembered that a fully elastic collision where the mass difference is great, the velocity of lighter one can almost double afterwards). So, just double that vector.

Lets say v is your general direction. Now I'd just randomly choose points from a cone defined with height |v| and some arbitrary chosen angle or do some other scattering (maybe you'll find something about projectile scattering)

I have watched the video and I also think they exaggerated the physics to make it look better.

Hope that helps
Hi unbird,

Thanks for your input. I'll try out something like you suggested.

In the mean time, I have this question: should I model the spark in world space or in model space? I can see each has advantages and disadvantages:

- World space: I have hard time keeping the rotation and position of the spark to be in view when the car moves fast. However, I think world space will allow more realistic simulation.

- Model space: great for keeping the spark visible with the car, but feel weird in some situations and not realistic.

Thanks for your help.
Quote:Original post by b_thangvn
should I model the spark in world space or in model space? I can see each has advantages and disadvantages:

I would go world space, then you can handle all particles using the same sytems and reference points.

In terms of how the particles would move (from the initial collision), there would be a random distribution of velocities between the two surfaces, centred on the half way point.

E.g if the car's bodywork (travelling at say 20m.s^-1) is colliding with a static wall, the particles would generally be travelling at around the 10m.s^-1 mark. The spread of velocities would depend on the reletive hardness of the surfaces and drag co-efficents, and would really be treated as an empirical value. It's something you can play around with to get it looking right.
If you have two cars colliding , one travelling at 20m.s^1 and one at 10m.s^-1, the central point would be 15m.s^-1

You could start of with this formula and modify for dramatic effect.

Vp=(V1 - V2)/drag + V2 + rand * spread

Play around with values of drag (starting at around 2.0f) and spread.
rand should be a random number between -0.1 and +0.1

Note that these should be vector values.

This topic is closed to new replies.

Advertisement