Full Device Motion Rotation - Floating Particles

I’m creating an effect for a client, which consists in multiple Ring emitters, rotating accordingly to the device motion Y axis.

When it reached 359, it reverts back instead of continuing a smooth rotation.

Here’s how the patch looks like:

It’s connected to the 3D occluder rotation:
Captura de Tela 2023-06-09 às 11.50.01

Here’s how the rotation reverses after it reaches 0/359

It’s not a critical error but it makes me annoyed and would love to have a solution to it.
Scripting is also welcome.


I think it’s because of the way the expo smoothing works. It’s taking the 360 and slowly taking it back to zero instead of starting there and wrapping around. One solution could be to use a delay value to accumulate rotation values. You would subtract the previous rotation from the current rotation, then add it to the accumulated value. The effect will be that the value can go negative, or beyond 360 and it doesn’t have the same wrapping behavior, so the expo smoothing interpolation won’t jump around. I think you might also need a special handler to detect when the value wrapped around and then subtract 360 from it.

I hope that makes sense, but if it doesn’t, you can give me a simple reproduction project and I can show you how to implement it.

Another solution would be to some trig math that would make it so 360 and 0 are actually the same value. Then you can map that value to ±180. This solution isn’t as clear in my mind, but it could work.

I couldn’t visualize what you meant, but here’s a blank project file in case you want to try:

Device Motion Rotation.arprojpkg (12.1 KB)

Ok, so you don’t actually need to set the rotation of the particles at all. You just need to move them into world space (outside of the device object). You DO still need to include the device motion patch to enable the rotational “world space” that allows this to happen.

But… then you lose the smoothing.

@teijaboo09 did you solve this weird rotation issue at some point? The y value only goes from -90 to 90, but the signs on z and x flip when you hit the threshold. I think your lookAtYAxis patch might do the trick. @jepharaujo you could try playing around with that (it’s in the library).

I tried that way, the problem is that moving them into world space, besides losing the smoothing, makes me lose the rotating only on the Y axis feature.

Did you use the camera null inside the camera object?