I use CABasicanimation and SCNAction in scenekit to add the same animation, but with different results
enter image description here I am now using CABasicanimation and SCNAction to add an animation of rotating an M_PI around the axis to the node with the same initial settings, but the results of the two are different, as shown in the figure.The center of the sphere is the origin of the coordinates. The initial actions of the two arrows are the same, but the final action scene is different after animation. Is this related to the initial action I used to set? Their final actions should be the same, right?
sign_1 = [scene_obj.rootNode childNodeWithName:@"arrowsign" recursively:NO];
sign_2 = [sign_1 clone];
[rootNode addChildNode:sign_1];
[rootNode addChildNode:sign_2];
sign_1.position = SCNVector3Make(1.0, 1.0, 1.0);
sign_1.scale = SCNVector3Make(0.05, 0.05, 0.05);
[sign_1 lookAt:SCNVector3Make(0.0, 0.0, 0.0)];
sign_2.position = SCNVector3Make(1.0, 1.0, 1.0);
sign_2.scale = SCNVector3Make(0.05, 0.05, 0.05);
[sign_2 lookAt:SCNVector3Make(0.0, 0.0, 0.0)];
// add animation using CABasicAnimation
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"rotation"];
animation.duration = 3;
animation.byValue = [NSValue valueWithSCNVector4:SCNVector4Make(0,1,0, M_PI)];
animation.fillMode = kCAFillModeForwards;
animation.removedOnCompletion = NO;
// add animation using SCNAction
SCNAction *rotationAction = [SCNAction rotateByX:0 y:M_PI z:0 duration:3];
[sign_1 runAction:rotationAction];
[sign_2 addAnimation:animation forKey:@"rotation"];