Skip to content

Commit

Permalink
Fix 3D light rotation angle calculus when Y is the top (#6004)
Browse files Browse the repository at this point in the history
- In order to get back the same light result as before, 27° should be subtracted to the rotation angle.
  • Loading branch information
D8H authored Dec 4, 2023
1 parent b6f25db commit ed46356
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Extensions/3D/DirectionalLight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace gdjs {
this.rotationObject.rotation.y = -gdjs.toRad(this.elevation);
} else {
// 0° becomes a light from Z+.
this.rotationObject.rotation.y = gdjs.toRad(this.rotation) - 90;
this.rotationObject.rotation.y = gdjs.toRad(this.rotation - 90);
this.rotationObject.rotation.z = -gdjs.toRad(this.elevation);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Extensions/3D/HemisphereLight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace gdjs {
this.rotationObject.rotation.y = -gdjs.toRad(this.elevation);
} else {
// 0° becomes a light from Z+.
this.rotationObject.rotation.y = gdjs.toRad(this.rotation) - 90;
this.rotationObject.rotation.y = gdjs.toRad(this.rotation - 90);
this.rotationObject.rotation.z = -gdjs.toRad(this.elevation);
}
}
Expand Down

0 comments on commit ed46356

Please sign in to comment.