Tweening Position to Angle

I think that within the Tween extension, there should be an action that allows you to tween an object’s position by a specified distance, at a specified angle. It would allow users to tween objects in situations where it has to go a certain direction, but the X,Y is not necessarily known. Doing this with trigonometry is sketchy at best, from my experience, and tweening position by angle would make the process a whole lot easier and more secure.

1 Like

You can tween object variables and use those variables in any action.

Just to clarify on this, Triarite’s asking for a tween method that lets you say “tween an objects position in an direction/angle”. Sort of similar to the “Apply force (angle)” action, but via tween.

There’s not quite an equivalent right now that we could find.

Right, I was a bit too quick on this. :blush:

I’m not sure I would call trigonometry sketchy, because I think it’s what would be used if the feature was added. :smile:
My math is too rusty for that I’m afraid. I think it’s about sine/cosine of the angle to get the x/y ratio, multiplied by the distance… Something like that. :speak_no_evil:

I can only agree with the feature request considering my math illiteracy… :pensive:

I’d prefer an expression like Object.GetPositionOfDistanceByAngle(distance, angle), it would be more powerful as it would be useable everywhere.

I agree, but how would you return x and y?

Oh, true :confused: I guess it would have to be Object.GetPositionOfDistanceByAngleX(distance, angle) and Object.GetPositionOfDistanceByAngleY(distance, angle)

Oh, true :confused: I guess it would have to be Object.GetPositionOfDistanceByAngleX(distance, angle) and Object.GetPositionOfDistanceByAngleY(distance, angle)

Are there any plans to implement this, or is there a workaround available?

the way without math (from your side) might be to create an object and position it using “put an object around another”
then tween the object you want to that position object.

trigonometry would be much more efficient tho.

@Triarite
The formula is:
moveToPosX = distance * cos(angle) + currentPosX
moveToPosY = distance * sin(angle) + currentPosY

I made an example: Upload files for free - moveToByDistanceAndAngle.zip - ufile.io
(i didnt find a way to upload here so i had to use a file-upload-site, i think it will be removed after 30 days)

PS: Easy file upload is really missing here on the forum LoL.

2 Likes

just want to mention, that these events here are very unnecessary

first of, the condition always is not need, when you want to do stuff all the time, since a conditionless event is always by nature.
secondly there is absolutly no reason to calculate it all the time. it is only needed once, right before the tween.
depends on what you want to do with distance and angle, this can/should be done in a single event

but cool first post Manuel, i think you are the first one i have seen here, who´s first post is an answer, not a question. And then with an example as well. Welcome!