I ran into a very strange problem today.
I've been doing some work on my AvatarWrapper class, and have been toying with the idea of allowing you to programmatically set the matrix for each bone. So far it works great on the PC, but on the Xbox I get this exception:
Output window:
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.dll
An unhandled exception of type 'System.NotSupportedException' occurred in mscorlib.dll
Additional information: NotSupportedException
on this seemingly harmless chunk of code:
| void AddBoneOffsetsToMatrix(IList<Matrix> BoneTransforms) |
| { |
| for (int i = 0; i < boneOffsets.Length; i++) |
| { |
| BoneTransforms[i] *= boneOffsets[i].Transform; |
| //if (!boneOffsets[i].Keep) |
| // boneOffsets[i].Transform = Matrix.Identity; |
| } |
| } |
This method is called every frame in the draw method, and it loops through all of the BoneOffsets and applies them to the corresponding bone. BoneOffset is a simple class with two variables: Keep and Transform. Transform is self explanitory, and Keep is a bool that is used to determine whether to only keep the transform for that frame.
If I leave the keep-checking code in there, it crashes with the exception on the if(!boneOffsets[i].Keep) line. By commenting it out I delay the crash to the i++ portion of the loop. It's always after the first line of that loop, apparently, and is always on the first object of the loop.
If I take out the call to this method, then it runs fine on the Xbox. But if I do that then I won't have this cool functionality to set the bone positions manually.
Any ideas?
"Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"
In Playtest:
Avatar Land |
The MANLY Game for MANLY Men The signature that was too big for the 512 char limit