Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Coord Transformation

Started by pikebu Dec 16, 2005 at 12:01 AM 2 replies 350+ views
Original Post
pikebu
pikebu
Hi, is there any function in DirectX to transform a Vector from one Coord-System into another? If yes, what function is it? And if no - how can this be easily done? Best regards Pikebu
smitty1276
smitty1276
It's a matrix multiplication...

Your new coordinate systems basis vectors X, Y, Z will be used to create a transformation matrix...

|   X   ||   Y   ||   Z   ||0 0 0 1|
pikebu
pikebu
Can you explain this thing a little more detailed?
:-(
smitty1276
smitty1276
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.