Correctly apply frame transform to light direction.

PiperOrigin-RevId: 665340267
Change-Id: Ida16ddbf3a057ffd3e260b71180a45acbf749931
This commit is contained in:
Yuval Tassa
2024-08-20 06:47:17 -07:00
committed by Copybara-Service
parent 2425358c3b
commit ad9cd7301e
2 changed files with 34 additions and 4 deletions
+6 -3
View File
@@ -3222,11 +3222,14 @@ void mjCLight::CopyFromSpec() {
void mjCLight::Compile(void) {
CopyFromSpec();
double quat[4]= {1, 0, 0, 0};
// frame
if (frame) {
mjuu_frameaccumChild(frame->pos, frame->quat, pos, quat);
// apply frame transform to pos, qunit is unused
double qunit[4]= {1, 0, 0, 0};
mjuu_frameaccumChild(frame->pos, frame->quat, pos, qunit);
// rotate dir
mjuu_rotVecQuat(dir, dir, frame->quat);
}
// normalize direction, make sure it is not zero