![]() While (unprocessedNodes.Count > 0 & !existsInAssimpAnimation) If we add an animation channel for a non existent node assimp crashes NodeAnimationChannel animationChannel = (channel =>ĭebug.Log("Setting up animation channel for: " + joint.name, joint) If (joint.childCount = 0) return // Don't animate leavesīool isRoot = joint = * Start by setting default position and scale keysįoreach (Transform child in ansform) * For the root node (hips), set scale, world position and world rotations Private void ExportJoint(Transform joint) If (animation.currentTime >= animation.duration)Į() ĮxportJoint() Private void SampleNextFrameOfAnimation()įoreach (AnimationChannel animationChannel in animation.animationChannels)Ī(, animation.currentTime) Throw new AssimpException("File for imported animation must exist!") Private static void ValidateFileExists(string path) = new Metadata.Entry(MetaDataType.Int32, 1) ĭurationInTicks = animation.duration * ticksPerSecond,Į() = new Metadata.Entry(MetaDataType.Int32, 100) = new Metadata.Entry(MetaDataType.Int32, -1) = new Metadata.Entry(MetaDataType.Int32, ticksPerSecond) | PostProcessSteps.ValidateDataStructure) Scene = assimp.ImportFile(, PostProcessSteps.OptimizeGraph Private void OnRequestExport(ExportFormat exportFormat)Į() Progress = animation.currentTime * ticksPerSecond / (float) exportedAnimation.DurationInTicks OutputFolder = () Į(, fbxCallback) Į(, gltfCallback) Į(2Export, gltf2Callback) Į(, daeCallback) Īnimation = () Gltf2Callback = (2Export, () => OnRequestExport(ExportFormat.GLTF2)) ĭaeCallback = (, () => OnRequestExport(ExportFormat.DAE)) GltfCallback = (, () => OnRequestExport(ExportFormat.GLTF)) Private Assimp.Animation exportedAnimation įormatIds = assimp.GetSupportedExportFormats() įbxCallback = (, () => OnRequestExport(ExportFormat.FBX)) Private readonly AssimpContext assimp = new AssimpContext() Public float interval => 1.0f / ticksPerSecond Public enum ExportFormat // Indices corresponding to Assimp formats Public Assimp.ExportFormatDescription formatIds This is the export code: public class ExportController : Singleton ![]() Unity gives some AABB errors when playing the animation which could indicate that it cannot calculate the bounds due to NaN values, but I do not know why I have these NaN values in the first place. It even crashes the animation preview panel in the inspector. The fbx file works perfectly well when imported into Blender or Maya, but when in open Unity editor to import the file the positional values on the rig when playing the animation are super fucked up. I use Assimpnet to export an fbx file with a skinned mesh, skeleton and animation from at runtime.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |