- Home /
Transform.forwrard of a Sprite?
Hi,
Since most code that I've stumbled upon shooting (bullet instantiation) uses transform.forward, I tried it and transform.forward of my player or weapon object on it's hand are always (0,0,-1) no matter which direction I move.
So how can I set transform.forward for my 2D sprites?
Answer by Eric5h5 · Sep 29, 2014 at 07:49 PM
Use transform.up or transform.right, depending on which way is "forward" for your sprite.
That's what I want to learn exactly. How transform.up or other ways is defined for a sprite that it can be different from other sprites.
I initially thought in 2D, in contrast to 3D, up is standard among all sprites.
There's no standard; it depends on how you draw your sprites. Just use transform.up or transform.right, whichever is appropriate.
You could also design a game with transform.left or transform.down as the default shooting direction.
True, although preferably -transform.right and -transform.up. Left and down are undocumented and deprecated, even though they still work (for now).
Your answer
Follow this Question
Related Questions
AddForce transform.right not working correctly in 2d 1 Answer
In unity3d client “push” an object with a rigidbody2d slower than the host 0 Answers
How can I smooth damp the rigidbody2D rotation at the end? 2 Answers
rotate 2d object without affecting the rigidbody ? 1 Answer
Maintain x axis distance between a 2d rigidbody and mouse 1 Answer