Question

Am trying to do this with three.js

I have this PlaneGeometry(a rectangle) and I want it to move along the vertexes of a CircleGeometry, just like a train on a rail.

any idea how to achive this realy smoothly?

Was it helpful?

Solution

You could take your THREE.Mesh and .add(object) it to a new THREE.Object3 at the center of your THREE.CircleGeometry, then move your THREE.Mesh to the edge of the circle by .set(x,y,z) it's position. Note that now your mesh is added to the object3, the positions of your mesh will be relative to the object3. This means that when you rotate the object3, the plane will pivot around it, and eventually rotate around the circle. The way I described would only work for circles. If you want more complex shapes, I'd use THREE.Spline.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top