How to access model normals in "world space"?
-
gamebeavis
- Posts: 12
- Joined: Mon Jun 25, 2007 11:45 pm
How to access model normals in "world space"?
I was curious how to access a models vertex position and normals translated into world space. Basically, if I load a model into irrlicht, and perform an animation, rotation, and translation I dont think the actual mesh data changes, just the view of it does or does it actually change? If it dosnt, how do I access the vertex/normal data in its changed form?? If it does change I suppose I can just read that data directly from the mesh buffer of the node??
the data held in the mesh buffers doesn't actually change, just the position which it is rendered from. so if you want a vertex position in world space, you have to transform the position by the model's absolute transformation matrix:
normals are a unit vector that holds a direction rather than a position, so it makes no sense to translate or scale them. so just rotate them instead:
Code: Select all
node->getAbsoluteTransformation().transformVect(tempPosition)Code: Select all
node->getAbsoluteTransformation().rotateVect(tempNormal)