fix gyro and tornado

This commit is contained in:
RandomityGuy 2023-05-09 22:22:19 +05:30
parent edd29b1cad
commit 69199b9da7

View file

@ -615,14 +615,18 @@ class DtsObject extends GameObject {
var dot1 = normal.dot(vertexNormals[i1]);
var dot2 = normal.dot(vertexNormals[i2]);
var dot3 = normal.dot(vertexNormals[i3]);
if (!StringTools.contains(this.dtsPath, 'helicopter.dts') && !StringTools.contains(this.dtsPath, 'tornado.dts'))
if (dot1 < 0 && dot2 < 0 && dot3 < 0) {
var temp = i1;
i1 = i3;
i3 = temp;
}
// if (!StringTools.contains(this.dtsPath, 'helicopter.dts') && !StringTools.contains(this.dtsPath, 'tornado.dts'))
// ^ temp hardcoded fix
// if (dot1 < 0 && dot2 < 0 && dot3 < 0) {
if ((dot1 < 0 && dot2 < 0 && dot3 < 0) || StringTools.contains(this.dtsPath, 'helicopter.dts')) {
var temp = i1;
i1 = i3;
i3 = temp;
}
// }
var geometrydata = materialGeometry[materialIndex];
for (index in [i1, i2, i3]) {
@ -834,8 +838,10 @@ class DtsObject extends GameObject {
for (i in 0...mesh.nodeIndices.length) {
var mat = mesh.initialTransforms[i].clone();
mat.scale(-1);
mat.transpose();
var tform = this.graphNodes[mesh.nodeIndices[i]].getRelPos(this).clone();
tform.prependScale(-1);
mat.multiply(mat, tform);
boneTransformations.push(mat);
@ -849,8 +855,8 @@ class DtsObject extends GameObject {
var vec = new Vector();
var vec2 = new Vector();
vec.set(vertex.x, vertex.y, vertex.z);
vec2.set(normal.x, normal.y, normal.z);
vec.set(-vertex.x, vertex.y, vertex.z);
vec2.set(-normal.x, normal.y, normal.z);
var mat = boneTransformations[mesh.boneIndices[i]];
vec.transform(mat);