bonsairobo / smooth-bevy-cameras

Bevy camera controllers with buttery, exponential smoothing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does this crate support 2d well?

bayou-brogrammer opened this issue · comments

commented

All the examples are using 3D, but I was trying to get it to support 2D as well. It seems i have to manipulate the eye as well to keep the player in the center of the screen, but it makes for a jagged movement

It wasn't designed for 2D. But I think it should work in theory, if you make the player the target and the camera the eye, much like a 3rd person perspective in 3D.

I think in practice you will just set eye = target = player position for 2D. With smoothing, the camera transform will converge towards the player.

Was trying to make it work with 2D as well, but scratching my head re: how exactly to do it... wonder, would any of you mind sharing a quick snippet? (or maybe it should be added to examples/?)

It works fine for me. Just query your target position, then set LookTransform's eye and target to the position. Of course since it's 2d you'll have to convert the Vec2 to Vec3, but there's a nice helper method for doing that: .extend().

Going to close this since @musjj confirmed it works as expected.