What is the difference between:
myModel.transform.SetToTranslation( *some Vector3* )
and
myModel.transform.translate( *some Vector3* )
(where myModel is of type ModelInstance)
Specifically, what are the side-effects of these operations?
And most importantly for me, what are some typical use cases in which you'd use one method over the other?
setToTranslation
sets the matrix to the translation. In other words, it removes every transformation the matrix had prior to the call (e.g. any translation, rotation and scale) and then sets it be a translation matrix with the specified values.
translate
will post-multiply the current transformations of the matrix with a translation matrix containing the given translation, resulting in:
transform.translate(x,y,z) == transform.mul(tempMatrix.setToTranslation(x,y,z))
The major side effect from using translate
(which is matrix math and not specific to libgdx) is that any transformation prior to it might (will) influence the translation.
This post might be helpful for you: http://badlogicgames.com/forum/viewtopic.php?f=11&t=17878&p=75338#p75338
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With