Question by
PreWant · Nov 02, 2018 at 07:59 PM ·
transformtransform.rotation
Instantiate with transform.rotation not shooting where aiming
Hello I am trying to make a top down space shooter, and I want to shoot projectiles there I am pointing too, I use a joystick for that rotating the spaceship, but 1 full circle of they joystick makes the projectiles do 2 full circles, and I am very confused... Probably because of negative values or smt, but here is my code for Instantiating them:
void Update () {
if (Input.GetKey(KeyCode.D)&& delay <=0)
{
Instantiate(bullet, transform.position, transform.rotation);
Debug.Log(transform.rotation);
Debug.Log(transform.rotation.normalized);
delay = timeBtwShots;
}
delay -= Time.deltaTime;
}
And here is the code of the bullets:
private void Update()
{
transform.Translate(transform.up * speed * Time.deltaTime);
}
pointing the spaceship up makes them shoot up, pointing it down makes them shoot up, pointing left or right makes it shoot down... I have the spawning script attached to an empty game object which is a child of the spaceship.
Comment
As you can see tried messing with normalized, but didn't rll help...
Your answer
![](https://koobas.hobune.stream/wayback/20220612181422im_/https://answers.unity.com/themes/thub/images/avi.jpg)