Manually manipulate mesh rotation in a time based looped rotation alteration

Hi there,

thanks for your time.

Recently I made some 3D- text which is spinning 360 backwards on x-axis in the animation loop.

var time = Date.now() * 0.003;
mesh.rotation.x = 10 * Math.PI/360 * time;

And the mesh rotates. And it does it “heads down” half the time which means you cannot read it anyway while the rotation.x is between -90 and 90 degrees while it is rotating backwards.

So I waited for the rotation angle to be -90 degrees and tried to rotate the mesh for 180 ( or ANY ) degrees so it would be readable by being flipped around.
And maybe that worked what I could not see because the rotation is set to the time based position just the next frame.

How can I turn the mesh and let the time- based rotation continue from this rotation-position?

Thanks again in advance.

You did not share the code of how you try to flip the text. As I’m not native English speaker, it is hard to understand what you want to achieve and what you get instead. It is always better to share online editable code.

After making a lot of assumptions and guesses, here what I came up with:

https://codepen.io/boytchev/full/BaEjzdJ

image

The left [R] just rotates. The right [R] rotates and flips. This is done in line 65 and uses trigonometry. If you are allergic to cosine, the same effect is available in line 68.

In case this is not what you look for, I’m sorry.

If you have time, you may look at this.

3 Likes

Pavel, thank you very much.

It is exactly what i meant and it works great. And it’s brilliantly compact.

Additionally I got aware that a timestamp can be given to the animationloop so I/ one do(es) not need to compute it every frame.
Another THANKS!!

1 Like