79735965

Date: 2025-08-14 23:08:11
Score: 0.5
Natty:
Report link

I did not manage to find a solution without help. As I mentioned in another question, I happened upon a package on GitHub called RealityActions that solved a lot of problems with animation in RealityKit.

It most definitely solved the issues I am asking about in this question. My solution for this is:

func turnAndMoveAction(byAngle angle: Float, andDistance distanceAsVector: SIMD3<Float>, withDuration duration: TimeInterval) -> FiniteTimeAction {
    return Group([
        MoveBy(duration: duration, delta: distanceAsVector),
        RotateBy(duration: min(duration, PlayerNode.animationDuration), deltaAnglesRad: SIMD3<Float>(0.0, angle, 0.0))
    ])
}

func demo() {
    self.start(turnAndMoveAction(byAngle: .pi / 2.0, andDistance: SIMD3<Float>(12.0, 0.0, 0.0), withDuration: 3.0))
}

this runs the grouped actions exactly as I had expected, without them interfering with each other, and with them running for the duration one would expect.

I cannot recommend RealityActions enough if you are coming from SceneKit, SpriteKit or Cocos2D.

Reasons:
  • Blacklisted phrase (1): another question
  • Blacklisted phrase (0.5): I cannot
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: PKCLsoft