|
@@ -153,9 +153,8 @@ export class Transform
|
153
|
153
|
get right(): Vector3
|
154
|
154
|
{
|
155
|
155
|
if(this._right === Vector3.ZERO) {
|
156
|
|
- const rotationMatrix = this.orientation._toRotationMatrix(); // R
|
157
|
|
- const u = rotationMatrix.block(0, 2, 0, 0).read(); // R * [1 0 0]'
|
158
|
|
- this._right = new Vector3(u[0], u[1], u[2]);
|
|
156
|
+ this._right = new Vector3(1, 0, 0)
|
|
157
|
+ ._applyRotationQuaternion(this.orientation);
|
159
|
158
|
}
|
160
|
159
|
|
161
|
160
|
return this._right;
|
|
@@ -167,9 +166,8 @@ export class Transform
|
167
|
166
|
get up(): Vector3
|
168
|
167
|
{
|
169
|
168
|
if(this._up === Vector3.ZERO) {
|
170
|
|
- const rotationMatrix = this.orientation._toRotationMatrix(); // R
|
171
|
|
- const v = rotationMatrix.block(0, 2, 1, 1).read(); // R * [0 1 0]'
|
172
|
|
- this._up = new Vector3(v[0], v[1], v[2]);
|
|
169
|
+ this._up = new Vector3(0, 1, 0)
|
|
170
|
+ ._applyRotationQuaternion(this.orientation);
|
173
|
171
|
}
|
174
|
172
|
|
175
|
173
|
return this._up;
|
|
@@ -181,16 +179,10 @@ export class Transform
|
181
|
179
|
get forward(): Vector3
|
182
|
180
|
{
|
183
|
181
|
if(this._forward === Vector3.ZERO) {
|
184
|
|
- const rotationMatrix = this.orientation._toRotationMatrix(); // R
|
185
|
|
- const w = rotationMatrix.block(0, 2, 2, 2).read(); // R * [0 0 1]'
|
186
|
|
- this._forward = new Vector3(-w[0], -w[1], -w[2]); // (*)
|
187
|
|
-
|
188
|
|
- /*
|
189
|
|
-
|
190
|
|
- (*) in a right-handed system, the unit forward vector is (0,0,-1)
|
191
|
|
- in a left-handed system, it is (0,0,1)
|
192
|
|
-
|
193
|
|
- */
|
|
182
|
+ // in a right-handed system, the unit forward vector is (0, 0, -1)
|
|
183
|
+ // in a left-handed system, it is (0, 0, 1)
|
|
184
|
+ this._forward = new Vector3(0, 0, -1)
|
|
185
|
+ ._applyRotationQuaternion(this.orientation);
|
194
|
186
|
}
|
195
|
187
|
|
196
|
188
|
return this._forward;
|