Reproduction
Appuyer sur R et virer à droite tout en tirant. Plus on tourne, et plus les lasers partent vers le bas.
Même problème avec L + gauche + laser.
Si on affiche les nodes de collisions, il y a exactement le même problème.
model m = CreateModel(Laser);
float X, Y, Z, SX, CX, SY, CY, SZ, CZ;
X = shooter.Rotation.X*PI*2;
Y = shooter.Rotation.Y*PI*2;
Z = (shooter == PlayerShip ? PlayerRotationZ : shooter.Rotation.Z) *PI*2;
SX = sin(X); CX = cos(X);
SY = sin(Y); CY = cos(Y);
SZ = sin(Z); CZ = cos(Z);
X = pos.X;
Y = pos.Y;
Z = pos.Z;
m.Rotation = shooter.Rotation;
if (shooter == PlayerShip) m.Rotation.Z = PlayerRotationZ;
m.Position.X = shooter.Position.X + CY*CZ*X + (SX*SY*CZ-CX*SZ)*Y + (CX*SY*CZ+SX*SZ)*Z;
m.Position.Y = shooter.Position.Y + CY*SZ*X + (SX*SY*SZ+CX*CZ)*Y + (CX*SY*SZ-SX*CZ)*Z;
m.Position.Z = shooter.Position.Z + SX*CY*Y - SY*X + CX*CY*Z;
m.Velocity.X = -1 * (CX*SY*CZ+SX*SZ) * speed;
m.Velocity.Y = -1 * (CX*SY*SZ-SX*CZ) * speed;
m.Velocity.Z = -1 * (CX*CY) * speed;
Problème à moitié réparé dans la version 190213 :
Les tirs ne partent plus vers le bas, mais ils ne suivent plus la rotation sur l'axe Z du player. C'est moins gênant, mais pas très immersif...