I am trying to add bullet holes to my FPS whenever you shoot. I am changing the values of the bullet hole instance's GlobalTransform in a variable and then setting it to the variable. This worked fine for the origin, but it is not working for the basis. I need to change the basis to have it face the correct direction.
Here is my code:
Vector3 y = normal;
Vector3 x = y.Cross(Vector3.Up);
Vector3 z = x.Cross(y);
globalTransform.basis = new Basis(x, y, z);
GD.Print("Variable basis: " + globalTransform.basis);
hitEffectInstance.GlobalTransform = globalTransform;
GD.Print("Instance basis: " + hitEffectInstance.GlobalTransform.basis);
And here is an example of the printed output when I shoot a slanted surface:
Variable basis: ((-0.538021, 0, 0), (0, 0.8429316, 0.2894666), (0, 0.538021, -0.4535148))
Instance basis: ((1, 0, 0), (0, 1, 0), (0, 0, 1))