Hi unity community!
Just a quick ( i hope ) question, i am trying to make it so that the player of my game is able to spawn a shield in front of them, but it faces one way all the time, not the facing the direction the player is facing which is what i want it to do. The images below show my progression.
Thanks for your help!
-Alias
Sorry, the images are the wrong way up. The bottom is the first, middle is second, top is third.
Set the rotation when you instanitate the shields, if you do not know how post the code you use to create the shield and I’ll show you.
Here it is
function Update ()
{
if(Input.GetButtonDown("Jump"))
{
var bullit = Instantiate(bullitPrefab, transform.Find("Spawnpoint").transform.position, Quaternion.identity); //transform.position
bullit.tag = "wormprojectile";
}
}
Oh by the way, thanks for replying!
Don’t know if this helps your issue but I’ve had a similar problem with instantiating 2D objects and getting them to face the player. I originally tried using Quaternion.identity but the instantiation faced the same direction as the camera i.e. the player was looking at the back of the object.
In the end I used “objPrefab.transform.rotation” instead and it worked. Though check that the obj when imported into Unity3D is aligned on the XY axis with Z as the 3rd dimension.
If you follow what I’ve done your code should look like:
var bullit = Instantiate(bullitPrefab, transform.Find(“Spawnpoint”).transform.position, bullitPrefab.transform.rotation);
Let me know if you’ve already found a solution - I’ll be interested to see what worked for you.
Cheers.
the TT tutorials rule;)


