Original Post
🔒 Locked
🎮 Unity
Coord Transformation
Advertisement
It's a matrix multiplication...
Your new coordinate systems basis vectors X, Y, Z will be used to create a transformation matrix...
Your new coordinate systems basis vectors X, Y, Z will be used to create a transformation matrix...
| X || Y || Z ||0 0 0 1|
Think of the "standard" 3d coordinate space... you have an x-axis (basic vector <1, 0, 0, 0>), a y-axis (basis <0, 1, 0, 0>), and a z-axis (basic <0, 0, 1, 0>).
Pretend you want to transform the coordinate to a coordinate space where the y axis becomes x, the z-axis becomes y, and the and the x-axis becomes z.
You would multiply by this matrix...
|0 1 0 0| <-"x" basis
|0 0 1 0| <-"y" basis
|1 0 0 0| <-"z" basis
|0 0 0 1|
If you want to translate the coordinate frame as well, the 0 at the end of each basis should become the negative dot product of the vector3 position of the camera and the vector3 of the basis itself.
Pretend you want to transform the coordinate to a coordinate space where the y axis becomes x, the z-axis becomes y, and the and the x-axis becomes z.
You would multiply by this matrix...
|0 1 0 0| <-"x" basis
|0 0 1 0| <-"y" basis
|1 0 0 0| <-"z" basis
|0 0 0 1|
If you want to translate the coordinate frame as well, the 0 at the end of each basis should become the negative dot product of the vector3 position of the camera and the vector3 of the basis itself.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement