so i have a rectangular prism rotating away from vector3.zero (with a sphere at vector3.zero),
and i want the prism’s square face to face away from vector3.zero
and this is the result i get
this could be fixed if the x was increased by 90
using transform.rotation = Quaternion.Euler(transform.rotation.x + 90, transform.rotation.y, transform.rotation.z);
Make sure ‘forwards’ on your prism is facing in the z or blue axis. Assigning a look rotation will will effectively be pointing ‘forwards’ to your direction, so have to make sure that forwards makes sense with respect to your object.
It’s not really clear what you actually want to do here. First of all subtracting zero from a position, just gives you the position again. (123,42,59) - (0,0,0) == (123,42,59). That’s because the concept of a position IS the direction vector from the coordinate space origin to that point.
So your code would only work when the object you want to rotate is located at the origin of the world. Though since you use the object’s own position it doesn’t really make much sense to begin with.
Your second code example is just plain wrong. the x,y,z and w components of a Quaternion are NOT euler angles. Those are values between -1 and 1 as they are the components of a unit quaternion (a 4d-complex number system). So treating them as euler angles just makes no sense.
In addition LookRotation actually takes two direction vectors, the second (up) vector is only used to determine the rotation around the look axis. If non is specified, Vector3.up is used.
Rotating by 90° on the x axis will rotate the euler angles system into the gimbal lock position. This is the worst orientation you want to have as you’re loosing one degree of freedom when using euler angles. That’s why Unity actually uses quaternions. They do not suffer from gimbal lock as euler angles do.
From your description and the image it’s hard to tell what is actually happening. Are your gizmos in the editor actually set to “local” and “pivot”? It looks like it may be set to “global”. You should keep them at local and pivot, otherwise you may get the wrong idea where the pivot is and how the object is oriented.
Note that LookRotation only cares about the “forward” vector (blue) and the up vector (green). If you need a different relative orientation, you can use an empty gameobject as a parent and orient the child prism the way you want it. Now you just rotate the parent and everything should be fine.