- Home /
2d "fake" shadow is running away
hey guys. iam currently trying to bring some 2d fake shadow into a top down game. basically iam trying to do something like this: http://www.youtube.com/watch?feature=player_embedded&v=XQ_bdIKJqp4 put with a blured black sprite underneath the car and just with code and no light in the scene. so the shadow should have an offset depending on how the car is currently turned
i have tried something like this (put into the shadow sprite with an offset of x:0.1 y:0.0 z:0.1):
#pragma strict
var carshadow : Transform;
var offset : Vector3;
function Start () {
}
function Update () {
transform.position = carshadow.position+offset;
transform.rotation = carshadow.rotation;
}
but the shadow is just running away to the top right and will never come back :( could you maybe help me out with that? thank you!
um... why are you setting the transform.position
? Don't you want to set the carshadow.position
? Or does your shadow move your car>
not? i thought i need transform.position cause its moving(or at least it should) when the car is turning around. and nope, the shadow does not moving the car. the car is the moving object. the shadow sprite is just in there
Then you should be setting the position of the shadow. Try that and see the results :)
Your answer
Follow this Question
Related Questions
[2D] - Moving the child moves the parent <-- Unwanted behavior 1 Answer
[2d] Sprite drawing offset from real position 1 Answer
How change offset of Sprite Material ? 2 Answers
Texture / Material offset doesn't work 1 Answer
Changing button texture by setting a texture offset of a sprite sheet?(SOLVED) 1 Answer