Commit a2690009 authored by rockyl's avatar rockyl

增加affectChildren属性,矩阵是否影响子节点

parent c4311fa4
......@@ -120,7 +120,7 @@ export default class InteractComponent extends ScillaComponent {
* @param e
*/
hitTest(e): boolean {
const matrix = this.transform.getMatrix(false, true);
const matrix = this.transform.getMatrix(false, true, true);
matrix.transformPoint(e.x, e.y, this.localPos);
let result = false;
......
......@@ -209,7 +209,7 @@ export default class Transform extends ScillaComponent {
const parentTransform: Transform = entity.parent.getComponent(Transform);
if (parentTransform) {
this._renderAlpha = parentTransform._renderAlpha * this.alpha;
_globalMatrix.concat(parentTransform.getMatrix(false));
_globalMatrix.concat(parentTransform.getMatrix(false, false, true));
} else {
this._renderAlpha = this.alpha;
}
......@@ -226,9 +226,9 @@ export default class Transform extends ScillaComponent {
/**
* 获取矩阵
*/
getMatrix(withPivot: boolean = false, invert: boolean = false): Matrix {
getMatrix(withPivot: boolean = false, invert: boolean = false, affectChildren = false): Matrix {
let matrix;
if(this.affectChildren){
if(this.affectChildren || affectChildren){
matrix = withPivot ? this._globalPivotMatrix : this._globalMatrix;
if (invert) {
const invertMatrix = this._globalInvertMatrix;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment