It's pretty difficult to explain, I tried doing it on a bunch of different surfaces but I couldn't find any patterns.
Essentially the static shape is created via a function that is fed a position and a brick normal
%rotation = normal2Rotation(%normal);
%explosive = new StaticShape()
{
datablock = C4PlacedStaticShape;
position = %position;
rotation = %rotation;
normal = %normal;
sourceObject = %source;
client = %source.client;
};
MissionCleanup.add(%explosive);
The initial axis-angle rotation of the shape is supplied by the first line there. Note that if you were to call
%explosive.setTransform(%explosive.getPosition() SPC %rotation), I'm pretty sure the result would be inaccurate, because I believe one is supposed to be in radians while the other is in degrees?
Anyways at this point I'd get the transform and attempt to rotate it again like this:
%rotation = getWords(%explosive.getTransform(), 3, 6);
%rot1 = %rotation;
%rot2 = %normal SPC mDegToRad(90);
%rotation = combineAxisAngleRotations(%rot1, %rot2);
%explosive.setTransform(%explosive.getPosition() SPC %rotation);
I tried calling it with arguments in both orders to no avail, and I also tried adjusting the rotation before the shape is instantiated, as well as with and without
mDegToRad(). The second rotation is created using the normal of the brick the shape is sitting on, and then just an arbitrary rotation of 90 degrees for testing purposes.