Unity Quaternion.FromToRotation Equivalent

What would be our equivalent function to do something like this:

const newRot = Quaternion.FromToRotation(transform.up, rayhit.normal)
transform.rotationQuaternion.multipyInPlace(newRot)

I tried this but it is glitchy:

const axis = BABYLON.Vector3.Cross(this.chassis.up, this._centerRaycastResults.hitNormalWorld);   
const angle = Math.acos(
     Math.max(-1, Math.min( 1, 
         BABYLON.Vector3.Dot(this.chassis.up, this._centerRaycastResults.hitNormalWorld)
         ))
      )
const quatRot = BABYLON.Quaternion.RotationAxis(axis.normalize(), angle)
this.chassis.rotationQuaternion.multiplyInPlace(quatRot)  

Ended up going with:

const alignQuat = BABYLON.Quaternion.FromLookDirectionLH(
    this.chassis.forward.scale(-1),
    this._rayCasts.center.results.hitNormalWorld
)
this.chassis.rotationQuaternion = BABYLON.Quaternion.Slerp(this.chassis.rotationQuaternion, alignQuat, 10 * delta)

does just what I need!

You. making a driving game ? @Pryme8

Just an jankey one, nothing like your car sim. The one you made is top tier, mines super arcadey more like mario cart.

My first thought though was “damn wish I could just fork mackeys stuff”.

On a side note, I miss you brother! Hope all is well on the islands for you.