How to split out multiple animations from Collada file in SceneKit

前端 未结 3 2011
梦谈多话
梦谈多话 2021-01-03 00:12

I am loading a third-party .dae Collada file as a scene into a SceneKit project.

The .dae file has many different animations in it, set at different times/frames. I

3条回答
  •  一个人的身影
    2021-01-03 00:32

    As Toyos mentioned in his answer, enumerate the CAAnimationGroup using SCNSceneSource and retrieve the CAAnimation objects as follows:

    NSURL *daeURL = [[NSBundle mainBundle] URLForResource:@"exportedFilename" withExtension:@"dae"];
    
    SCNSceneSource *sceneSource = [SCNSceneSource sceneSourceWithURL:daeURL options:nil];
    
    NSMutableArray *myAnimations = [@[] mutableCopy];
    
    for (NSString *singleAnimationName in [sceneSource identifiersOfEntriesWithClass:[CAAnimation class]]) {
        CAAnimation *thisAnimation = [sceneSource entryWithIdentifier:singleAnimationName withClass:[CAAnimation class]];
        [myAnimations addObject:thisAnimation];
    }
    

提交回复
热议问题