Entity rotation animation doesn't go beyond 180 degree?

I use simple transform and move method to animate my entity. Something like this :

let transform = Transform(scale: .one, 
                                            rotation: simd_quatf(angle: .pi, axis: SIMD3(x:0, y:0, z:1), 
                                            translate: .zero)
myEntity.move(to: transform, relativeTo: myEntity, duration: 1)

All is well, but when I try to rotate any more than 180 degree, the rotation stays still ? How do I animate something that wants to turn 360 degree?

Thanks

rotation stays still

Do you mean no rotation at all or rotation stops at pi, or something else ? What happens if you remove duration ? Or set relative to nil ?

Did you try a rotation of - .pi/2 for instance to get 3*.pi/2 ?

You could animate in 2 steps: pi then the part over pi (not very clean solution though).

I made a simple test.

  • pi rotation
let rot = simd_quatf(angle: .pi, axis: SIMD3(x:0, y:0, z:1))
print(rot)

I get:

simd_quatf(real: 7.54979e-08, imag: SIMD3<Float>(0.0, 0.0, 1.0))
  • pi/2 rotation
let rot = simd_quatf(angle: .pi/2, axis: SIMD3(x:0, y:0, z:1))

I get

simd_quatf(real: 0.7071068, imag: SIMD3<Float>(0.0, 0.0, 0.70710677))
  • 0 rotation
let rot = simd_quatf(angle: 0 * .pi, axis: SIMD3(x:0, y:0, z:1))
print(rot)

I get:

simd_quatf(real: 1.0, imag: SIMD3<Float>(0.0, 0.0, 0.0))

real is zero. No rotation.

  • more than pi
let rot = simd_quatf(angle: 1.1 * .pi, axis: SIMD3(x:0, y:0, z:1))print(rot)

I get a rotation

simd_quatf(real: -0.15643445, imag: SIMD3<Float>(0.0, 0.0, 0.98768836))
  • more than pi
let rot = simd_quatf(angle: 1.5 * .pi, axis: SIMD3(x:0, y:0, z:1))print(rot)

get the expected rotation

simd_quatf(real: -0.70710677, imag: SIMD3<Float>(0.0, 0.0, 0.70710677))

So, simd_quatf computes rotation properly.

Hi, I mean if I try to rotate 1.5 pi, I get 90 degree counter clockwise, .pi I get 180 degree rotation clockwise. I guess it only rotates the difference, so if I try to rotate 4 pi (I assume this will rotate 360 twice) this will not rotate anything as this is basically 0 degree, Any idea on how to approach rotation in animation that doesn't involve repeating the move method?

Entity rotation animation doesn't go beyond 180 degree?
 
 
Q