View Single Post
# 2 30-09-2007 , 07:00 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
I at work now so I don't have time to finish this. Anyway here's one way for that particle going from blue to red within a specified radius of an object (pSphere1 in this case). Just add rgpPP and a cusom scalar attribute called effectRadius (set it bigger than the radius of your sphere to see the effect better) to your particle shape and enter the following into your runtime after dynamics expression:

Code:
vector $vWPos = worldPosition;
vector $vSPos = <<pSphere1.translateX, pSphere1.translateY, pSphere1.translateZ>>;
float $fDistance = mag($vWPos - $vSPos);

float $fEffect = 0;
if($fDistance < effectRadius);
	$fEffect = 1 - linstep(0, effectRadius, $fDistance);

rgbPP = <<$fEffect, 0, 1 - $fEffect>>;


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!