Can I reposition ONE point of an existing vector newLine?

I’m testing out a simple physics scenario where two objects are joined by a “distance” joint… imagine a pendulum swinging on an anchor point. I would like to draw a single visible line between these objects, like the string that attaches them.

The problem I face is that the distance joint (by my own preference) is slightly elastic: it stretches just a bit as the pendulum swings faster. Thus, I can’t just create a physical “string” body and join one end to the anchor and the other end to the pendulum using pivot joints. That object would not be elastic, which basically defeats this approach.

Using “display.newLine” it’s easy enough to draw the initial line: just set vector point 1 as the X/Y of the anchor, vector point 2 as the X/Y of the pendulum. But as the pendulum swings, I can’t think of a simple way to move the line with it, ensuring that its length increases as the elastic distance joint increases too. I was hoping there was a method to simply re-position ONE point of the line (vector point 2) to a new position, but the documentation doesn’t seem to indicate this is possible.

One “solution” is to delete and re-draw the line every game cycle, but I imagine this would be very inefficient. Another possibility I considered is doing a constant rotation of the visible string object, but this again could tax the performance, because every single game cycle I’d need to calculate the angle between the anchor and the pendulum and then rotate the string accordingly. That’s alot of repeated calculation for one object, I’m guessing.

Any other ideas or suggestions?

Brent Sorrentino
Ignis Design [import]uid: 9747 topic_id: 17569 reply_id: 317569[/import]

We’ve got a fan object that re-draws 5 lines to simulate strings fluttering in the breeze. Each line has 5 segments that are redrawn randomly within a tight range. We’ve put many of these fan objects on-screen at once and there’s no performance hit.

Redrawing your line is probably the easiest way. There’s probably not much difference overhead wise between repositioning one point and redrawing the whole thing as long as you remove the old one correctly. [import]uid: 40137 topic_id: 17569 reply_id: 66814[/import]