Help : Trajectory of an object in motion

Hello, and sorry for my bad english
I’m french science teacher and new user of Hype. I want to trace the trajectory of an object in motion.
I try to do this with a ladybug on a clock but I don’t find how to plot the (x,y) position of the ladybug each second. I must draw a new point with timeline. This trick only works if I know the path followed in advance. I can’t use this method for physics objects.
Can you help me ?coccinelle avance.zip (424.9 KB)

I wrote some code that would output the x and y positions of an element on a motion path in this post:

You can use this technique to get the values, though you will need to create your own elements or drawing that represents the path being traced.

Hi @jonathan, I actually had a play with trying this when @physique19140 first posted.

Getting the x,y is pretty easy and plotting a dot to mark the path is a simple clone at the coords but what I found a problem was getting the x,y when the angle of rotation is changed in the element you are trying to match as is the case of the example that is posted.This is couple with it being in a group.

I cannot remember off hand fully but I had some success but I did not find a good enough or complete solution to post anything back. But the above linked post will not work alone due to that rotation issue.

Oh, you’re right about the rotation issue. Off the top of my head, since you only need to read values, I’d think you could calculate the center point from JavaScript `getBoundingClientRect()` which (iirc) will encompass the element no matter the rotation.

Either that, or use the calculated transform matrix and then linear algebra to determine the top/left .

That may be the missing bit, I thing I tried other ways to get it but don’t think I tried that. If I still have the project I wrote and can get my head back into what I was doing with it I will try that…

Cheers