Box Collider 2D not following object rotation

Hello,

I’m using the new 2D tools and trying to make it so I shoot a bullet in the direction of my mouse pointer. The only problem is the BoxCollider2D on the bullet does not match the angle it is travelling. Here is what I am seeing

![1]

From what I can tell this is being caused by the X and Y rotation changing from the way I instantiate the bullet (only the Z rotation is important for 2D correct?) Here is the code that I am using to rotate the game object from which I instantiate the bullets

Vector3 upAxis = new Vector3(0,0,1);
Vector3 mouseScreenPosition = Input.mousePosition;
mouseScreenPosition.z = transform.position.z;
Vector3 mouseWorldSpace = Camera.mainCamera.ScreenToWorldPoint(mouseScreenPosition);
bulletSpawn.transform.LookAt(mouseWorldSpace, upAxis);

And here is the instantiation code

if (Input.GetButton("Fire1") && Time.time > nextFireTime)
	{
		nextFireTime = Time.time + fireRate;
		Instantiate(bullet, bulletSpawn.position, bulletSpawn.rotation);
	}

I have the same question. I’d be glad if someone could answer it. When my 2D panels are rotated with transform.Rotate their colliders are not rotated, allowing my player character through.

only the Z rotation is important for 2D correct?

Nah, that’s where the issue is coming from. Make sure to leave these axes at 0. I recommend using Quaternion.LookRotation for 2D LookAts:

transform.rotation = Quaternion.LookRotation(Vector3.forward, lookDirection);