torsdag 26 maj 2016

Becoming Airborne


The only possible step to take after successfully making the fire spread to nearby vertices was of course to make it also spread to nearby objects. This proved to be fairly straightforward, as we could use the same system of warmth pulses to ignite vertices on other objects. However, as we couldn’t access individual vertices of other objects the way we could access vertices of the same object, we had to tweak the system a bit.
We did a raycast from the burning object to all objects within a specified search radius bearing the “flammable” tag. At the point of intersection, a warmth pulse is sent out, similar to as if we had clicked on the object. Initially, the raycast was made from and to the center of objects, but that didn’t make for a very realistic spread. Fire would start to spread to nearby objects long before it was close enough. We tried to come up with a better way, and eventually decided to cast the ray not from the center of a burning object, but from the center of the fire itself - that is, the burning vertices. In each frame, we calculate a sort of bounding box for each pocket of fire in the scene, and cast rays from the center of that box. The result is a much more realistic spread.


screen_spread.png

Inga kommentarer:

Skicka en kommentar