I am having trouble getting this to work. I can fire a projectile just fine. The issue is that I need to fire the project in the direction the player is facing, and even offset the location of the shot by so many local units (not world).
I use this code to instantiate the bullet.
if(Input.GetMouseButtonDown(0)){
Instantiate(bullet, transform.position + new Vector3(-3,2,0), Quaternion.identity);
Instantiate(bullet, transform.position + new Vector3(3,2,0), Quaternion.identity);
}
I have tried adding velocity after this point, on the object by instantiating it to a variable. I have tried adding force based on the current objects vector3.forward and transform.forward with no success. I have also attempted to have the bullet read at start, the rotation of the linked game object, and match it so any velocity changes done on the bullet will match the rotation. But none of these things have worked.
I need the bullet to fire the direction the ship is facing.
It needs to come offset from the center point of the ship, and that offset should be accounted for in the rotation, where right now it is now.
Advice?