Sign in to follow this  
xynapse

Matrix -> Vector3?

Recommended Posts

Hi guys!




I have my light position stored in a matrix, after all calculations that were required.

Now i need to pass position as a vector3 to other method,

is it possible to obtain the 'actual' position from a matrix?




Let's say to obtain final position of my light i had to:

[code]

matrixLightPosition=actor_ModelMatrix*actor_BoneMatrix;

//where

// actor_ModelMatrix - is the actual model matrix for the player ( his position and current rotation )

// actor_BoneMatrix - is the selected bone matrix (position+rotation) - let's say it is his hand bone.

[/code]




What i need to do is get x,y,z of that rotated/translated position into a vector3:




vector3 position;




What should i do to get those?




Many thanks guys!!

Share this post


Link to post
Share on other sites
is this the local to bone matrix ? or bone to local matrix ? i'm not sure of what you want to do, but at a glance you can invert your matrixLightPosition and get the position from the 4th row or column depending whether you are in column major or row major for your matrices.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this