- Home /
Shooting in 2 dimensional games
How would I shoot upwards along the yaxis in a 2 dimensional game?
Answer by jtbentley · Sep 15, 2010 at 06:28 AM
Vector3.up would probably be the way to go :)
I wrote this code, The object is created but it is still not moving upwards. Anything wrong?
var newObject : Transform;
function FixedUpdate () {
if (Input.Get$$anonymous$$eyDown("m"))
{
Instantiate(newObject, transform.position, transform.rotation);
}
newObject.transform.position += Vector3.up * Time.deltaTime;
}
Did you attach the script to the projectile? SOunds silly but its a common mistake.
Answer by sam · Sep 15, 2010 at 07:39 AM
yeah I did ..
This answer should be a comment in response to the previous comment, not an answer to the question. Also, since this duplicates answers.unity3d.com/questions/20600/, you should delete this question entirely.
Your answer
Follow this Question
Related Questions
How to fire projectile in direction character is facing? 3 Answers
Multiplayer tank game 0 Answers
Air Strike shoot aiming at cross hairs in middle of the screen 2 Answers
How do i adjust the projectile path and direction? 1 Answer
Projectile Script 1 Answer