0

I'm trying to run an animation from a .dae file (3D model file) just once, this is my code:

SCNNode *object = (SCNNode*)[self getMyPlayerObject];
NSString *key = @"hit";
CAAnimation *animation = [_animations[key] copy];
[animation setSpeed:1];
[animation setTimeOffset:0];
[object addAnimation:animation forKey:key];

I've tried using animation.removedOnCompletion = YES; but is not working, I've tried setting a delegate and tried to detect it with the animationDidStop:finished: method, but it doesn't even get called, there's something weird when using CAAnimations on SCNNodesfrom DAE animations.

Is there any way of doing it?

Thanks in advance.

c4b4d4
  • 964
  • 12
  • 32

1 Answers1

2

Your animation is likely configured to be repeating. Check the repeatCount property to see if it's larger than 1. Setting it to 1 will repeat the animation once, but you can also set it to 0 to ignore it. if that's not it, you can look at the repeatDuration property and set it to 0 (to ignore it) if it's not already 0.

David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205