How can I get a CFrame along a BEAM?

I have a way of getting the position along a beam with a scale of 0 to 1, but I also need the rotation as well, basically a whole CFrame. How do I do that? I’m assuming it still has to do with the bezier curve but idk how to do that math.

What do you mean you need rotation? Mind drawing a sketch?

Like twisting an stuff




image

beam isnt a straight line so u cant just lerp cframes
u already got position from bezier so ur halfway there

for rotation u need the tangent of the curve

ez way:

  • get pos at t
  • get pos at t + epsilon (like 0.001)
  • (pos2 - pos1).Unit = forward direction
  • CFrame.lookAt(pos1, pos1 + dir)

that cframe will follow the beam properly

for twisting:
beam roll is just rotation around that forward axis
so do cf * CFrame.fromAxisAngle(dir, roll)

thats literally it
position = bezier
rotation = bezier derivative

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.