How to get Quaternion from other GameObject

Hi there
I’m really new to Unity and I’m still trying to get the hang of it. Today I stumbled over a little problem and even if I probably sound stupid, I will still ask :smiley:

var bullet = Instantiate(chosenBullet,transform.Find("Launcher"+launcher).transform.position, Quaternion.identity);
	bullet.rigidbody.AddRelativeForce(transform.forward * speed);

This code is suppose to shoot a bullet prefab from an empty in the direction, the emptys Z axis is pointing. I was trying a lot using mainly Google and the script reference but nothing worked so far.
Then I realized, then when the bullet is instantiated, it doesn’t copy the rotation from the empty where it is shooting from. So the question probably is, how can I get the Quaternion (Rotation) from the empty into the Instantiate function so it rotates the bullet in the correct angles when it gets created?

As I said on top, I’m really new t unity, speacially to scripting and I’m trying to get the hang of it. I hope I can learn something out of the Answers
Thanks a lot for taking the time to answer me.

mitti2000

The quaternion is stored in the empty GO’s transform. Access it as such:

 emptyGameObject.transform.rotation;

I have a similar problem and received this answer:

Assigning the force vector as a relative force instead of a regular force will ensure the force vector is in the objects local space instead of world space.

use constantForce.relativeForce = yourforcevector

instead of constantForce.force = yourforcevector

and that will make the force stay in the local space of your sphere

transform.forward is already relative, so either use “AddForce (transform.forward”, or else “AddRelativeForce (Vector3.forward”.