[SOLVED] Rotate y basis to normalized vector

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DaddyMonster

I’m looking for a method similar to look_at but instead of taking the target position it rotates to face a normalized vector3.

For example:

obj_1.transform.basis.x = Vector3(1, 0, 0)
obj_1.transform.basis.y = Vector3(0, 1, 0)
obj_1.transform.basis.z = Vector3(0, 0, 1)

Say I wanted to change the Y vector from (0, 1, 0) to: (0, 0, 1) tilting it forward. This would give:

obj_1.transform.basis.x = Vector3(1, 0, 0)
obj_1.transform.basis.y = Vector3(0, 0, 1)
obj_1.transform.basis.z = Vector3(0, -1, 0)

What’s the transform here so I can know the X and Z values without sheering or scaling?

My head is swimming from Khan Academy and 3 Blue, 1 Brown and I can’t find how to do this simple transform. A helping hand would be thoroughly appreciated.

:bust_in_silhouette: Reply From: DaddyMonster

Got it, I was able to update the y and then calculate the cross products using the default basis as a placeholder for the other and then doing the cross on the placeholder. Was simple in the end.

I’ll mark this as solved.