www.jcquan.com/RB/TrimeshParticles2.zip
Beautiful!
I noticed the bursts had a slightly squarish initial shape, so I
changed it to randomize initial particle positions using spherical
coordinates instead of Cartesian coordinates. In the two trimesh
constructors, I changed this line:
Direction.Append New Vector3D(Rnd-0.5, Rnd-0.5, Rnd-0.5)
to this:
Direction.Append RandomSphericalVector3D
and added this function:
===================
Function RandomSphericalVector3D() As Vector3D
const Pi = 3.1415926536
const Pi2 = 6.2831853072
dim Lon as double = Rnd*Pi2
dim Lat as double = (Rnd-0.5)*Pi
dim CosLat as double = Cos(Lat)
dim Ret as new Vector3D(CosLat*Cos(Lon), CosLat*Sin(Lon), Sin(Lat))
Ret.MultiplyBy Rnd // scale radius from 0-1
return Ret
End Function
===================
In this version, particles will be denser toward the origin, but
that's how explosions are, so it looks good. One could get a uniform
density within a sphere simply by generating vectors the original way
and rejecting ones that fall outside a given radius.
I think it helps the look of the demo, although it might not matter in
a game if other stuff is happening at the same time.
lj
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|