- Got rid of ShadowCaster.
- Added click behavior.
The reason I had to eliminate ShadowCaster was because it was downgrading performance too much when the stage was big. Because I am working with full screen stage it was a big issue.
Thanks to Andy Zupko who recommended a better alternative for shadows for what I was trying to do, and even provided the logic for calculating positioning based on light and sphere position. The new version has a plane with blurred circle baked texture material per sphere. Positioned at the bottom of the sphere and with the following logic from Andy to calculate position:
var vector: Number3D = new Number3D(m.x - light.x, m.y-light.y, m.z - light.z);m being each marble (sphere), and light, well... the light :s.
var spherePos:Number3D = new Number3D(m.x, m.y, m.z);
vector.normalize();
vector.multiplyEq(m.radius);
vector = Number3D.add(vector, spherePos);
this.position = vector;
This runs on every frame as well because as the position of the sphere relative to the light position changes, so does the shadow obviously.
You'll also notice that I added onClick event handler as well finally. More on that on my next posting.
Oops! spheres too big? Visit the bigger site here.
Cheers!