Jump to content
  • Advertisement
Sign in to follow this  
afraidofdark

scale on object in different spaces

This topic is 896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to scale an object in different spaces. For example, in a hierarchical system I want to scale a node as if it is in its parent coordinate space, or in world space.

void ABT::Node::Scale(glm::vec3 val, TransformationSpace space)
{
  switch (space)
  {
  case ABT::TS_WORLD:
  {
    glm::quat ws = GetOrientation(ABT::TS_WORLD);
    m_scale += ws * val * glm::inverse(ws);
  }
  break;
  case ABT::TS_PARENT:
  {
    glm::quat ps;
    if (m_parent)
      ps = m_parent->GetOrientation(ABT::TS_WORLD);
    m_scale += ps * val * glm::inverse(ps);
  }
  break;
  case ABT::TS_LOCAL:
  {
    glm::quat ls = GetOrientation(ABT::TS_LOCAL);
    m_scale += ls * val * glm::inverse(ls);
  }
  break;
  }
}

Bad think with this code is, it doesn't apply transformation to one axis. It applies all three of them when I observe it.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!