How can I target a particular index of a PackedVector2Array using a tween?

I’m trying to use a tween to change the position of one of the points in a line2d, but I’m not sure what the syntax would be for this.

This is what I have: tween.tween_property(line, “points”, target_position, time)

Obviously this doesn’t work because points has more than one point to make the line. If I need index 1 of points specifically, how would I do that? Or do I have to address it as a whole PackedVector2Array?

EDIT: I found the answer to this in case anyone else stumbles across this. You use colons, like this:

tween.tween_property(line, "points:1, target_position, time)

TechieDamien,

Another way would be to add your own property with custom getter/setter and tween that. Your solution works, but more advanced things might be easier with this method.

HonoraryMancunian,

As someone who just casually saw this post on Everything (and has no idea what godot even is), I must say the title threw me

MossBear,

That was me last year too. :P

ImpossibleRubiksCube,

Tween as in tweening, from the animation term.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • test
  • CafeMeta
  • [email protected]
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • TheResearchGuardian
  • Ask_kbincafe
  • KbinCafe
  • feritale
  • Socialism
  • oklahoma
  • SuperSentai
  • KamenRider
  • All magazines