Skip to content

Commit

Permalink
fix node set world scale (cocos#5245)
Browse files Browse the repository at this point in the history
  • Loading branch information
YunHsiao authored and jerrywwl committed Aug 26, 2019
1 parent d3c4312 commit ca0cbd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion cocos/3d/framework/batched-skinning-model-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { GFXAttributeName, GFXBufferTextureCopy, GFXFormatInfos } from '../../gf
import { GFXFormat, GFXType } from '../../gfx/define';
import { GFXDevice } from '../../gfx/device';
import { IGFXAttribute } from '../../gfx/input-assembler';
import { Node } from '../../scene-graph/node';
import { Material } from '../assets/material';
import { IMeshStruct, Mesh } from '../assets/mesh';
import { Skeleton } from '../assets/skeleton';
Expand Down
10 changes: 5 additions & 5 deletions cocos/core/math/mat3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import CCClass from '../data/class';
import { ValueType } from '../value-types/value-type';
import { Quat } from './quat';
import { IMat3Like, IMat4Like, IQuatLike, IVec3Like } from './type-define';
import { IMat3Like, IMat4Like, IQuatLike, IVec2Like, IVec3Like } from './type-define';
import { EPSILON } from './utils';
import { Vec3 } from './vec3';

Expand Down Expand Up @@ -204,7 +204,7 @@ export class Mat3 extends ValueType {
}

/**
* 三阶与四阶矩阵乘法
* 取四阶矩阵的前三阶,与三阶矩阵相乘
*/
public static multiplyMat4 <Out extends IMat3Like> (out: Out, a: Out, b: IMat4Like) {
_a00 = a.m00; _a01 = a.m01; _a02 = a.m02;
Expand Down Expand Up @@ -299,7 +299,7 @@ export class Mat3 extends ValueType {
}

/**
* @zh 根据指定四维矩阵计算三维矩阵
* @zh 取四阶矩阵的前三阶
*/
public static fromMat4 <Out extends IMat3Like> (out: Out, a: IMat4Like) {
out.m00 = a.m00;
Expand Down Expand Up @@ -347,7 +347,7 @@ export class Mat3 extends ValueType {
/**
* @zh 计算位移矩阵
*/
public static fromTranslation <Out extends IMat3Like, VecLike extends IVec3Like> (out: Out, v: VecLike) {
public static fromTranslation <Out extends IMat3Like, VecLike extends IVec2Like> (out: Out, v: VecLike) {
out.m00 = 1;
out.m01 = 0;
out.m02 = 0;
Expand All @@ -363,7 +363,7 @@ export class Mat3 extends ValueType {
/**
* @zh 计算缩放矩阵
*/
public static fromScaling <Out extends IMat3Like, VecLike extends IVec3Like> (out: Out, v: VecLike) {
public static fromScaling <Out extends IMat3Like, VecLike extends IVec2Like> (out: Out, v: VecLike) {
out.m00 = v.x;
out.m01 = 0;
out.m02 = 0;
Expand Down
2 changes: 1 addition & 1 deletion cocos/scene-graph/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ export class Node extends BaseNode implements INode {
parent.updateWorldTransform();
Mat3.fromQuat(m3_1, Quat.conjugate(qt_1, parent._rot));
Mat3.multiplyMat4(m3_1, m3_1, parent._mat);
Mat3.fromScaling(m3_2, this._scale);
Mat3.fromScaling(m3_2, this._scale); m3_2.m08 = this._scale.z;
Mat3.multiply(m3_1, m3_2, Mat3.invert(m3_1, m3_1));
this._lscale.x = m3_1.m00;
this._lscale.y = m3_1.m04;
Expand Down

0 comments on commit ca0cbd9

Please sign in to comment.