this.transform is inheriting rotation unexpectedly

private Transform heading;

Start(){heading = transform;}

Then later :

if (Physics.Raycast(transform.position + originOffset, Vector3.down,out hit,  castDistance, ground))
            grounded = true;
            heading.rotation = Quaternion.FromToRotation(heading.up, hit.normal);

I then do my Tranlate upon heading, which is using the normal as it’s up… But when I go

transform.position = heading.position;

The rotation is applied aswell. Do not want this rotation applied; Any ideas?

The line heading = transform is the issue here. transform is passed by reference, not value, hence any changes to heading.rotation will automatically reflect to transform as well.