MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / translate

Method translate

engine/source/runtime/function/animation/node.cpp:107–132  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

105 const Vector3& Node::getPosition(void) const { return m_position; }
106 //-----------------------------------------------------------------------
107 void Node::translate(const Vector3& d, TransformSpace relativeTo)
108 {
109 switch (relativeTo)
110 {
111 case TransformSpace::LOCAL:
112 // position is relative to parent so transform downwards
113 m_position = m_position + m_orientation * d;
114 break;
115 case TransformSpace::OBJECT:
116 // position is relative to parent so transform upwards
117 if (m_parent)
118 {
119 m_position =
120 m_position + (m_parent->_getDerivedOrientation().inverse() * d) / m_parent->_getDerivedScale();
121 }
122 else
123 {
124 m_position = m_position + d;
125 }
126 break;
127 case TransformSpace::AREN:
128 m_position = m_position + d;
129 break;
130 }
131 setDirty();
132 }
133
134 //-----------------------------------------------------------------------
135 void Node::rotate(const Quaternion& q, TransformSpace relativeTo)

Callers 1

applyAnimationMethod · 0.45

Calls 1

inverseMethod · 0.45

Tested by

no test coverage detected