Ati Posted May 31, 2011 Share Posted May 31, 2011 Hi all, Whit GEO_Detail::translate or translateGroup I can translate the group from its original position, but i don't want to "translate" it, i have a world space coordinate and i want to set the position of the group there. Is it possible to do that? thanks in advance! Ati Quote Link to comment Share on other sites More sharing options...
graham Posted May 31, 2011 Share Posted May 31, 2011 (edited) You can build the translation from your current position to the target position and then use that value to translate the points. Pseudo code is something like this: // The local space center position of your geometry group. UT_Vector3 center = current center of your group // The world space transformation of your parent geometry container. UT_DMatrix4 world_xform = world transform matrix of your geometry object // The world space position you want to transform to. UT_Vector3 destination = world space target position // Multiply the local coordinate by the parent transform to transform that position to world space. // Then get the vector from the target position to that position and use it to do the translation. UT_Vector3 translation = destination - (center * world_xform) You can then pass the translation vector to the translate function and your geometry should be moved to that location in world space, regardless of what crazy xforms you might have on your geometry object. Edited May 31, 2011 by graham Quote Link to comment Share on other sites More sharing options...
Ati Posted June 2, 2011 Author Share Posted June 2, 2011 Thank you for the help! I will take a look at it today how it is gonna work. Ati Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.