Rotate a projectile on Z axis for a 2D Game played on X and Y axis?

Hello,

The game always stays at z = 0 and movement of a projectile (non-kinematic rigidbody collider) is always on X and Y axis. Now when the projectile hit a wall (static collider) - it reflects.

I have got the reflection right, but can’t figure a way to turn the projectile in the way of its movement. I want to keep angles on X and Y to be zero and just change the angles on Z axis.

It is one of those questions which, you know, it is very simple - hence I am missing something simple. I wish if you guys could help to me get it.

// Code for projectile

private void OnCollisionEnter(Collision hit)
	{
		if(hit.transform.tag == "SideCollider")
		{
			dirToTravel =  Vector3.Reflect(dirToTravel, hit.contacts[0].normal);

                    // The below line is not right
    		this.transform.rotation = Quaternion.LookRotation(Vector3.Reflect(this.transform.forward, dirToTravel));		
    		}
    	}

IMAGES:

PROJECTILE properties

24784-projectile.png

SIDE COLLIDER properties

24785-sidecollider.png

Thank you.

regards,
Karsnen

EDIT :
The projectile is a non-kinematic rigidbody collider. I changed it now and thanks for @pako to notifying me that.

Check out these posts:

They were only a search away. Hope it helps.