#### Archived

This topic is now archived and is closed to further replies.

# How to get position relative to matrix???

This topic is 5196 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was wondering if any could help me with finding the position of a point based on a matrix?? In other words i want to translate the point into the coordinate system of the matrix so that the matrix is origin/aligned x,y,z and the point is based on the matrix not on the world matrix. In directx 7 you could get position relative to another object, that is what im trying to do but in dx8. Any help or suggestions are much appreciated! Thanks, Maurice

##### Share on other sites
Multiply the point by the inverse of the matrix?

(Not sure if this is what you want, but here you are.)

##### Share on other sites
Sorry to sound dumb but what function would multiplying a matrix be in dx? Or is that the same as multiplying the rows of the matrix by the point?

Thanks,
Maurice

##### Share on other sites
D3DXVec3TransformCoord( )

##### Share on other sites
If you have the new frame and the point in the same frame of reference, then just multiply the point by the frame ( 4x4 matrix ).

You have to remember that you''re unique, just like everybody else.

##### Share on other sites
I got the inverse of the matrix , then used the vec3TransformCoord function but as the matrix was rotated the output stayed the same. Shouldn''t the relative position change if a matrix is rotated (Point to the left of the matrix when rotated left can be come a Point in front of the matrix)???

Thanks,
Maurice

##### Share on other sites
if you just want to move your points without any what not... then you can simple add the coordinates of the point to the origin of your second coordinate system...

i.e.

point (x, y, z)
second coordinate origin (X, Y, Z)

the new coordinates of your point will be (x+X, y+Y, z+Z)