Getting access to time kept by AnimationPlayer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By humbletang

Hi there,

I have successfully modified a part of the rasterizer_scene_gles3.cpp to allow for loading a converted lidar file that I have prepared, but as you can see in this video I’m not currently aware of how to make use of information from the AnimationPlayer node.

What is the best way to get this information out of the animation player in a scene?

Thanks so much!

Have you tried using the current_animation_position property from AnimationPlayer?

Ertain | 2022-06-01 23:24

That looks very promising, thank you!

humbletang | 2022-06-01 23:26

I guess the thing that still has me stumped is how I’m supposed to get a reference to the AnimationPlayer node in my scene. Is it even possible for the VisualServer to query for a node like the animation player during it’s run up to rendering to the screen? I figure that’s the time when I would be interested in using the current_animation_position property.

Guess I have some learning to do around the cpp equivalent of a godot script line like $AnimationPlayer.get_current_animation_position()

humbletang | 2022-06-02 23:29

:bust_in_silhouette: Reply From: humbletang

voila ! https://drive.google.com/file/d/16bCat-U2d_RkD7Hy_GO2ofzclS4C0DAM/view?usp=sharing

I put together this work around since I’m not sure just yet how to reference the animation player and get it’s values from the engine side. The work around goes like this. I wrote a script attached to the particles node that queries for the animation player’s time. I then used that time as the x component of the node’s origin transform and then in the rasterizer I use that data to make sure that I select the right set of points from the scan data to draw via instancing.

It’s nice because I can also animate the camera position to dolly around in within the dynamic lidar data =D.

I’d love to know more about the right ways to do this, and I’d be happy to try to wrap this stuff up as a dynamic pointcloud data module to contribute if I could just get some assistance understanding what’s where in the codebase.

Have a good one