In cocos3D you can create a node from a pod file by simply executing:
If your pod file is available online, you could first download it locally:
If you want to save to a temporary directory, use:
[CC3PODResourceNode nodeFromResourceFile:podFileName];
Here you can find a full working sample.If your pod file is available online, you could first download it locally:
NSURL *url = [NSURL URLWithString:YOUR_URL_HERE];
NSData *urlData = [NSData dataWithContentsOfURL:url];
[urlData writeToFile:filePath atomically:YES];
then pass filePath
to nodeFromResourceFile
.filePath
identifies a file residing in the user documents directory (one of the few places where you can write files to, under iOS):NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"PODFILE.pod"];
If you want to save to a temporary directory, use:
NSTemporaryDirectory()
instead of documentsDirectory
.
沒有留言:
張貼留言