Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose path data #14

Open
simbleau opened this issue Nov 25, 2023 · 3 comments
Open

expose path data #14

simbleau opened this issue Nov 25, 2023 · 3 comments

Comments

@simbleau
Copy link
Contributor

I have the need to tessellate my vector graphics to receive a convex hull used for game physics.

I can easily do this with lottie and svg files, but rive doesn't seem to expose the underlying path data in the runtime.

Given framerate and animation length, Is there such a function of t, time, to receive the path geometry in that moment?

See: https://simbleau.github.io/rust/graphics/2023/11/20/using-vello-for-video-games.html#physics

@dragostis
Copy link
Contributor

rive-rs comes with a Vello back-end implementation included. You could get the path data by listening in on that implementation, but this pretty much means copy-pasting the implementation.

Another way to do this would be to query the path data from the runtime, but this would require writing quite a bit more APIs to get there.

@simbleau
Copy link
Contributor Author

I am suggesting the latter, e.g.

let handle = query_artboard.single();
let time = 0.25; // seconds
let path_data = bevy_rive::runtime::get_data(handle, time);

@dragostis
Copy link
Contributor

You could achieve that by listening to Renderer::draw_path after calling Scene::advance_and_maybe_draw. This will only give you the path data that changed from last frame though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants