- Home /
Bullets not orienting properly
I have a tank with a cannon sub-object "Mesh01". I am trying to shoot bullets by instancing a bullet at the cannon position and rotation. Everything was working fine until I made the tank a prefab and instantiated it with code instead of doing it in the scene.
I am logging the rotation of the bullet instance and it rotates as I rotate the cannon. It seems to be always facing downwards and instantly exploding into the ground.
var ibullet : Rigidbody = Instantiate(bullet, GameScript.TankOne.transform.Find("Mesh01").position, GameScript.TankOne.transform.Find("Mesh01").rotation);
Debug.Log("rot:"+ibullet.rotation );
ibullet.velocity = GameScript.TankOne.transform.Find("Mesh01").forward * - speed;
Comment
Your answer