[SOLVED] Rotating Cube along Curve

I am currently moving a bunch of cubes along a curve which is working great!

Currently I am trying to have it so the cubes are also orienting their rotation based on the curve.

I followed this solution and can get it working great. My issue is, my cube will be substituted out with a model where having the Up value of (0,1,0) - makes it sit on its side. So I believe I need to use an Up value of (0,0,0) to make it orient properly.

My issue is, when I set the Up value to (0,0,0) it seems as though my rotational code is no longer working. Iā€™m not getting any errors, it just is no longer rotating with the the curves facing.

Thoughts?

Here is what I followed and have working great with an Up value of 0,1,0 - my issue is I need to use an Up value of 0,0,0 for my model to be rightside up.

Thanks guys!

EDIT: I solved this by adding another line after my quaternion.setFromAxis I just manually rotateX like this:

obj.target.model.scene.rotateX(Math.PI/-2);

and is working exactly how I need it to!

1 Like