Closed ettoreleandrotognoli closed 6 months ago
cargo run --example cyberpunk --features bevy-inspector-egui
let y_limit = Limit::zero_to(500.);
let x_pid = PID::new(0.1, 0.5, 0.01);
let y_pid = x_pid.with_integral_limit(Limit::new(-25., 25.));
let offset = Vec2::new(200., 0.);
let camera = commands
.spawn(Camera2dBundle {
transform: Transform::from_translation(offset.extend(0.)),
..default()
})
//.insert(CameraFollow::fixed(player).with_offset(offset))
//.insert(CameraFollow::proportional(player, 0.1).with_offset(offset))
.insert(CameraFollow::pid_xyz(player, &x_pid, &y_pid, &x_pid).with_offset(offset))
.insert(ParallaxCameraComponent {
limits: Vec2Limit::new(Limit::default(), y_limit),
..default()
})
.id();
https://github.com/Corrosive-Games/bevy-parallax/assets/4960560/5e412807-d476-49dc-9193-01d66ecf8194
Love this! Great addition!
We should get this merged too I didn't realize it was still sitting here unmerged. @ettoreleandrotognoli
I'll update it, and fix the conflicts this week
I would really appreciate this! I think having to control the camera purely through move speed is very janky to work around.
hello @cdsupina sorry the delay The PR is updated
As we're using the
ParallaxMoveEvent
to move the camera, I want to provide some smart ways to generate it In that way I think less people needs to know theParallaxMoveEvent
internallyParallaxMoveEvent
now hastranlastion
instead ofcamera_move_speed
androtation
The
CameraFollow
component will generate theParallaxMoveEvent
using theTranslateStrategy
andRotationStrategy
I also updated the example in README and add a test to help us to keep it updated
Resolves #20