- Home /
Question by
theUndeadEmo · Dec 03, 2013 at 07:31 PM ·
shadow
creating a dynamic shadow using 2D Plane
i was wondering how would i go about making a dynamic shadow.
so the car rotates and the black oval (shadow) rotates and keeps its offset
the shadow is a plane, so was wondering how to get it orbiting around depending on the cars global rotation
i tried this but doesn't work
void updateShadow()
{
Quaternion rotation = Quaternion.Euler(Tr_Shadow.eulerAngles.x,Car.eulerAngles.y, Tr_Shadow.eulerAngles.z);
Vector3 negDistance = new Vector3(1f, 1f, -1f);
Vector3 position = rotation * negDistance + Car.position;
Tr_Shadow.rotation = rotation;
Tr_Shadow.position = position;
}
Comment
Your answer
Follow this Question
Related Questions
Shadow from spot light gets cut (unrealistic) 0 Answers
Best lightmapping wierd soft shadows 0 Answers
How can I get an invisible object to cast a shadow? 1 Answer
New 4.6 UI: how to make UI elements cast shadows 1 Answer
Soft Shadows are hard... 1 Answer