combine / convert rotations (Quaternion and Vector3)

Hi, i’ve been trying to convert / combine two rotation transforms into one to stop them overriding each other.

//----- tilts character to surfaces -----//
	transform.up = Vector3.Lerp(transform.up, surfaceNormal, Time.deltaTime * xRotSpeed);
	//----- tilts character to surfaces -----//
	
	//----- tilts left and right ------//
	transform.eulerAngles = Vector3(0, curAngle, 0);
	//----- tilts left and right ------//

I’m trying to either multiply / scale two together, to allow an X rotation to occur based on the surfaceNormal, or somehow convert the current Vector3.Lerp to allow me to extract a value to put into the X axis of the EulerAngles, as my character only has movement on the x and y (x for turning towards surfaces and y to rotate yaw based on forward velocity)

I hope you can help this hasgot me raging alot lately, tried so many Quaternion types and Vector scales and lerps its driving me nuts!

Thanks!
Renn

This is an untested variant of a working “angled with ground, but my spin” merged with your code. The way facingQ is created/used is probably the most interesting part:

// your lerp to smooth into normal:
Vector3 newUpV=Vector3.Lerp(transform.up,surfaceNormal,Time.deltaTime*xRotSpeed);
// convert new up into a rotation:
Quaternion newUpQ=Quaternion.FromToRotation(Vector3.up, newUpV);

// your spinning:
Quaternion facingQ=Quaternion.Euler(0,curAngle,0);

// combine head tilt and spin:
transform.rotation = newUpQ * facingQ;

The problem with setting transform.up then transform.eulerAngles is that there’s no good way to say “keep the work from the last instruction.” Building quaternions for each local spin lets you combine them with *. In this case, newUpQ is the tilt that takes from facing North, head up, to still facing north-ish, but head tilted to the target. Then *facingQ adds a local y-spin.