I have tried a lot of different options to try and get my bomb throw to work. I mean it does work but on player move my bomb throws incorrectly. I have gone through quite a bit to figure it out such as using velocity rather than Addforce but nothing seems to help. So I was hoping maybe someone had a suggestion. So the problem just to clarify is that if I move backward the bomb throws forward and if I move forward the bombs throw backwards. The rotation seems correct. This is in c#. Thank you for any reply.
//Bomb script:
void BombThrow() {
GameObject bomb = Instantiate(ExplosiveDevice, transform.position, transform.rotation);
Rigidbody rb = bomb.GetComponent();
rb.AddForce(bomb.transform.forward * bombLaunchSpeed);
}
//Movement Script (This is a seperate Script from my bomb script):
public float movementSpeed = 8.0f;
public float rotateSpeed = 5.0f;
void Update()
{
float x = Input.GetAxis("Horizontal") * Time.deltaTime * rotateSpeed;
float z = Input.GetAxis("Vertical") * Time.deltaTime * movementSpeed;
transform.Rotate(0, x, 0);
transform.Translate(0, 0, z);
}
Here is a video of my problem:
-KittenSnipes