I want to have a blob shadow projected immediately downwards underneath an object. However, if the object rotates then the projector rotates with it.
Does anyone know how to stop a blob shadow projector rotating with it?
Also, is there any easy way to define a different shape for different objects’ blob shadows? If I change the shadow projector it seems to effect all objects.
Another related question. How can I scale the cookie with a directional light? Presently the tiling texture is really huge, and there is no way to adjust the size of the texture as it projects.
Sorry for digging this up, but I thought it might be nice to save others from having to write this over and over.
private var orientation : Vector3;
private var offset : Vector3;
function Awake () {
orientation = transform.rotation.eulerAngles;
offset = transform.position - transform.parent.position;
}
function Update () {
orientation.y = transform.parent.rotation.eulerAngles.y;
transform.rotation.eulerAngles = orientation;
transform.position = transform.parent.position + offset;
}
If you add this script to your shadow projector, it’ll stay nicely floating over your object (how you positioned it). It copies the y rotation - so if your shadow isn’t perfectly round it’ll still match.