Draw lines that follow object

Hi everyone,
is there a way to draw lines that follow the movement of objects in the scene? It should look something like this:
Should I use LineSegs and query the position of my object with getPos()? I imagine there could be a problem because the center of the object is not where the line should be. How can I give that kind of information to the LineSegs class?

You can use getRelativePoint to transform a point local to an object into a global coordinate space.

If it is animated using skeletal animation, I suggest adding a bone to the end of the armature, and then using exposeJoint() to expose that node, after which you can query that joint’s position to draw with LineSegs.

Thank you for the help. I ended up using getPos(render) in combination with trigonometry.