How to animate obj model move along with curve

Hi Guys,

Crane combined with trolley1, trolley2 and beam, and my target is to animate the crane move along the curve rail like showed in picture 1.
There are coordinates in real time for trolley1 and trolley2
I tried with .lookAt(new THREE.Vector3(x,y,z)) and it shows the result in picture 2.
Is it possible to know the orientation for both trolley 1 and trolley 2 with current information (coordinates (X,Y,Z) for both trolley)
Could you please kindly advise how to achieve my target?


Picture2

Not really easy to do based on just xyz position. You would need to know the position along the curve ( 0 to 1 ), then use .getTangent and .getPosition to construct a transform from that.

These examples from the collection may be of interest to you.

SmoothTurnsToPath
FlightRouteQuaternion
MovementOnCurve
MotionAlongCurve
CarRacing

Spline Editor

1 Like