Creating tracing line that perfectly follows your mouse and the object from where your drag began is tough

I don’t understand… calculating the midpoint is quite easy, and angle and distance are pre-defined functions. There’s no need to choose some other starting point, only to end up calculating the center anyway

Just to clarify incase folks in the future find this thread:

The Angle expressions are calculated based off the object’s center to the destination point (Or destination object’s center if you’re doing Angletoobject).

The center of the object to 100x 100y will be a different angle than the leftmost center’s angle to 100x 100y because they are different

As shown in the images and videos above on the success, just using the center points and angle expressions will not be perfectly aligned with the starting point or destination point, because the “start” point of the object is the upper-leftmost point of that object.

This is why they’re having to do the extra math on calculating the proper center positions to move the object to, since they cannot just use the center point or origin point, as neither of them are correct for the used angle/width/etc.

If we were able to modify the center or origin point like with sprites, you could just set it’s position to the center of the “Drop”, it’s width to the distance between it and the cursor, and set the angle two the two. You wouldn’t need the extra step of readjusting the position to the delta between the two.

I’m sorry but no, this is not true, instead the opposite is true. The angle from point A to B is exactly the same as the angle from midpoint AB to point B (or any point on the infinite line, really). I’m assuming that when you say “leftmost center” you mean the center of the left edge? Which as you can see in the video is perfectly aligned.

Right! Except I believe we’re not talking about the same thing.

Starting from the leftmost center has a different angle than the object center.

If we were able to use that leftmost point directly (by modifying the origin point like I have on the sprite), less math would be needed to adjust the angle. Additionally, since the origin point was adjusted, less positioning events would be needed (because when you create an object the origin point is where it is dropped, you could drop it on the “Drop” object and it’d be already centered as desired).

Thank you, all.

@magicsofa - I am a coding noob, so I am sorry if I sound ignorant here but the code @Silver-Streak provided worked in the tracing as you can see from the video I uploaded.