Giter Club home page Giter Club logo

dolly's People

Contributors

blackphlox avatar emiliolaiso avatar expenses avatar fornwall avatar h3r2tic avatar jnises avatar junglie85 avatar marijns95 avatar repi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dolly's Issues

Jerkiness in smoothing

I'm noticing that when using smoothing, and when the camera is following an object, there is jerkiness that seems to be coming from the smoothing. And any changes I make to the smoothing parameters don't seem to help.

If the object makes a single jump from point A to point B, or the object stops moving, then the camera moves smoothly to it, but when the object is in constant steady-state motion, the camera has some small jerkiness/oscillation and is not as smooth as I might expect.

Simple test exhibiting this behavior is a small modification to the nested_driver.rs example, just changing the camera rig position to follow the target, and adding a dolly arm (similar to the follow example shown in the README):

diff --git a/examples/nested_driver.rs b/examples/nested_driver.rs
index 643ad0c..9bbd1e5 100644
--- a/examples/nested_driver.rs
+++ b/examples/nested_driver.rs
@@ -20,11 +20,13 @@ impl<H: Handedness> MovableLookAt<H> {
         target_position: dolly::glam::Vec3,
     ) -> Self {
         Self(            
             CameraRig::builder()
                 // Allow moving the camera
-                .with(Position::new(camera_position))
+                .with(Position::new(target_position))
                 // Predict camera movement to make the subsequent smoothing reactive
                 .with(Smooth::new_position(1.25).predictive(true))
+                .with(Arm::new(dolly::glam::Vec3::new(0.0, 1.5, -3.5)))
                 // Smooth the predicted movement
                 .with(Smooth::new_position(2.5))
                 .with(LookAt::new(target_position + dolly::glam::Vec3::Y).tracking_smoothness(1.25))
@@ -37,7 +39,7 @@ impl<H: Handedness> MovableLookAt<H> {
         camera_position: dolly::glam::Vec3,
         target_position: dolly::glam::Vec3,
     ) {
-        self.0.driver_mut::<Position>().position = camera_position;
+        self.0.driver_mut::<Position>().position = target_position;
         self.0.driver_mut::<LookAt>().target = target_position;
     }
 }

Then if you hold down one of the WASD keys, you'll see the jerkiness. Not sure if there's some combination/ordering of smoothing drivers that can help with this, or if it's inherent in the smoother itself. Or any other ideas?

Sequentially evaluating and replacing drivers

Hey! We're using dolly and wanting to swap out camera drivers at runtime (specifically Rotation and YawPitch). There are no helpers to expose this in the public API, but since the drivers Vec is (perhaps unintentionally) pub we can patch those in. Is that an intended use-case?

As an alternative approach we also looked into having both drivers on the stack so that we could set one of the two to IDENTITY, but as it turns out dolly doesn't really stack the drivers sequentially, instead the Position/Rotation/YawPitch (and maybe all the other) drivers replace a translation or rotation on update(), meaning only the last rotation or position sticks. This is also visible in the README example, where a camera has a Rotation (that is updated) but useless because the subsequent LookAt overwrites the rotation.

Option to use mint types

How would you feel about changing the public API to use mint types?

It could help avoid glam version issues and make it easier to use with other maths crates too.

Support for bbox/bsphere framing?

I saw in the readme that field of view is (intentionally) not part of this. But could it be?

Framing an object (smoothly) based on its bbox/bsphere is a common task for such rigs in the wild.

Allow configure the UP direction for LookAt driver

The current implementation in

pub fn look_at<H: Handedness, V, Q>(forward: V) -> Q
where
    V: Into<mint::Vector3<f32>>,
    Q: From<mint::Quaternion<f32>>,
{
    let forward: Vec3 = forward.into().into();

    let result = forward
        .try_normalize()
        .and_then(|forward| {
            let right =
                H::right_from_up_and_forward::<Vec3, Vec3>(Vec3::Z, forward).try_normalize()?;
            let up = H::up_from_right_and_forward(right, forward);
            Some(Quat::from_mat3(&Mat3::from_cols(
                right,
                up,
                forward * H::FORWARD_Z_SIGN,
            )))
        })
        .unwrap_or_default();

    From::from(result.into())
}

hard code Vec3::Y as the look at up direction. It would be great to have that configurable, so this package can be used in different camera setup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.