- Home /
Blob Shadow Always Pointing Down?
I have a ball (rigidbody, can move rotate etc) that I want a simple blob shadow on, so I attached a projector. The problem is, the projector rotates with the ball when it is moving around... Is there a simple way to keep the shadow projector pointed "down" (which is actually at a wall in my game).
Thanks!
Answer by CarbonTech Software · Jun 29, 2010 at 06:01 AM
Yep, there's a script that was developed specifically for that (speaking of which, I need to implement soon into my game). Oh, the script is written in CS (C sharp format). Just attach this script to the object with the blob shadow.
using UnityEngine; using System.Collections;
public class BlobShadowController : MonoBehaviour { void Update() { transform.position = transform.parent.position + Vector3.up * 8.246965f; transform.rotation = Quaternion.LookRotation(-Vector3.up, transform.parent.forward); } }
Thanks for the help! I can't seem to get it to work though... I have a ball prefab with a projector component set to a blob shadow material (and it also ignores the layer "NoShadow", which the ball is on), but I don't see a shadow. When I look at it running, it also looks like the projector is still rotating. All of this happens when I attach the script to the ball prefab. Am I doing it right? I am new to Unity :p
Never $$anonymous$$d! I got it figured out (created a separate shadow object, added the ball and shadow projector object into one prefab, assigned a script to the projector part of the prefab)
Your answer
Follow this Question
Related Questions
Blob shadow changes transparency 2 Answers
Blob shadow projector is not projecting properly 2 Answers
Do blob shadow projectors work on iPhone? 1 Answer
Blob shadow problem 2 Answers
[Unity3D 3.5.6f4] Get rid of shadow projector artefact 1 Answer