Jump to content

group position


Recommended Posts

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

Link to comment
Share on other sites

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 by graham
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...