Hello, this is something I'm having trouble figuring out, how to apply translation and scaling to a Spatial node, in such a way that the scaling does not affect the translation or the origin of the Spatial node and it's children.
I'm using GDNative with C++ to handle the scaling and translation logic in this way:
const auto depth = poly->m_poly->get_depth();
const auto ox = poly->m_poly->get_origo_x();
const auto oy = poly->m_poly->get_origo_y();
const auto origin = Vector3(ox, oy, depth);
const auto scale = poly->m_poly->get_anim_scale();
const auto scaling = Vector3(scale, scale, scale);
const auto rotation = poly->m_poly->get_anim_rotation();
const auto axis = Vector3(0.0, 0.0, 1.0f);
Where poly object is extending the Spatial object. Poly has an multimesh instance added to it with add_child, so setting the translation should affect the rendering of this multimesh instance.
What happens here is that the origin of the poly Spatial is affected by the scaling. According to my understanding currently this happens because the scaling affects the transformation matrix, which origin is part of.
Is there a simple way to scale without affecting the origin of the spatial class and it's children ? Or do I have to figure this out with some matrix math ?
Any help appreciated, thanks.