Current Rotation into Direction Vector for LookRotation

Hey there!
I’m trying to get some billboaring scripts working.
Currently I have…

Vector3 camDirection = Camera.main.transform.position - transform.position;
if(velocity!= Vector3.zero)
{	
transform.rotation = Quaternion.LookRotation (velocity, camDirection);
transform.Rotate (Vector3.right,90f);
}

It rotates the particle based on its velocity, but then rotates it by it’s y axis so that it faces the camera. The final 90 degree rotation is a tweak to get it exactly how I want.

It works perfectly but whenever I try to have an arbitrary rotation for x and z (like with rotation velocities) I can’t get it perfect. I get close but certain angles don’t line up correctly.

Specifically I have a vector3 for a rotation velocity and a separate quaternion to hold the rotations and then I apply the final rotation + billboarding to transform.rotation.

I’m looking for a way to have independent rotations and then apply a final rotation for the x and/or y and/or z axes to align to the camera.
This comes close…

vector3 camRotation = Quaternion.LookRotation(camDirection).euler;
camRotation.x = 0;
camRotation.y = 0;

transform.rotation = savedRotation * Quaternion.Euler (camRotation);

But obviously just zeroing out values isn’t how rotations work.

Quaternion.LookRotation seems like the best bet, but I don’t know how to make my current rotation into the form of a Vector3 direction.

Any help would be greatly appreciated.

Hope this helps…

void SetBillBoardRotation()
    {
        float angularSpeed = 10f;
        Vector3 direction = Camera.main.transform.position - this.transform.position;
        Quaternion desiredRotation = Quaternion.LookRotation(direction);
        desiredRotation.y = 0;
        this.transform.rotation = Quaternion.Slerp(this.transform.rotation, desiredRotation, Time.deltaTime * angularSpeed);
    }

OH MY GOODNESS. I swear in my first testing, every reference vector I used (transform.forward/up/right) all yielded the same results. But I just tried transform.up and it worked (I guess this makes sense because I want to orient based on the y axis?)

Anyways!

Final code is here…

Quaternion trueRotation; //Holds rotation so billboarding doesn't mess it up
Vector3 camDirection = Camera.main.transform.position - transform.position;
transform.rotation = Quaternion.LookRotation (trueRotation * Vector3.up, camDirection);
transform.Rotate (Vector3.right,90f);

NOTE (Wouldn’t let me post as answer)