change transform order for relative setPosition to SRT

This commit is contained in:
Nick Fisher
2024-02-05 08:43:54 +08:00
parent 48a1c6dc0b
commit 6561af6825
3 changed files with 7 additions and 3 deletions

View File

@@ -1211,7 +1211,9 @@ namespace polyvox
decomposeMatrix(transform, &translation, &rotation, &scale);
if(relative) {
translation += math::float3( x, y, z );
math::mat3f rotationMatrix(rotation);
math::float3 relativeTranslation = rotationMatrix * math::float3( x, y, z );
translation += relativeTranslation;
} else {
translation = math::float3(x,y,z);
}
@@ -1250,6 +1252,7 @@ namespace polyvox
transform = composeMatrix(translation, rotation, scale);
tm.setTransform(transformInstance, transform);
}