Rotate object moving along path accordingly to path direction - r3f

I have an object following a path in R3F, I’m new in three and fiber, I made the object follow the path but can’t make it rotate in the currant path direction on the Y axis,
this is what I have:

useFrame(({ clock }) => {
const t = clock.getElapsedTime() * 0.05;
const pos = curve.getPointAt(t);
cameraGroup.current.position.copy(pos);

const tangent = curve.getTangentAt(t).normalize();
//cameraGroup.lookAt(pos.clone().add(tangent))

it follows the path perfectly but when I uncomment LookAt it displays a white screen… Another word error… I translated it myself from three in some tutorial on YouTube, any ideas on how to make this last line proper?

Nevermind all was about cameraGroup.current.lookAt(pos.clone().add(tangent))

1 Like