Matrix4?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Guest

Matrix4?

Post by Guest »

I know there is a way to grab a Matrix4 from a node, but is there a quick easy way to take a point that is not part of mesh (any point, dosnt matter) and multiply it by the Matrix4? Or would I need to write my own?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

You mean a point outside of the mesh?
Guest

Post by Guest »

Ok, what I was looking to do was this. I have a mesh, loaded into a Node. Now the node is transformed and rotated, for viewing purposes. In another part of my code, I am attempting to creaate a collision model from the vertices of the mesh. There fore, I read the mesh vertices into memory, and then I need to transform and rotate THOSE values into 'real' space. I was just wondering, If there was a way to pass a S3DVertex value to the Matrix4 of the Node, and have it spit out the transformed value of the point??
Guest
Posts: 35
Joined: Mon Feb 02, 2004 7:17 pm
Location: Russia, Saint-Petersburg

Post by Guest »

I'm not sure that it's what you need but still...

There is S3DVertex::Normal vector. And there is transformVect method in matrix4. So you can do the following:

Code: Select all

S3DVertex vertex; // your vertex
ISceneNode* node; // your node

core::matrix4 mat = node->getAbsoluteTransformation(); // your matrix

// apply the same transformation to your vertex
mat.transformVect(vertex.Normal);
Do you need this or I missed something?
there is another guest...
Guest

Post by Guest »

Ok, I think that is what I wanted, but now how would I reverse what I did? So I can get the original point back?? Would I do this?

core::matrix4 InvertMat;
bool Inverted = mat.getInverse(InvertMat);
mat.transformVect(Point);

Or is that NOT what I want to do?? I guess I confussed why the getInverse is a bool value, how could you NOT get a matrix back??
Post Reply