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

project comment in Camera #349

Open
ctzcs opened this issue Dec 30, 2024 · 1 comment
Open

project comment in Camera #349

ctzcs opened this issue Dec 30, 2024 · 1 comment
Labels
Area: Documentation Issues related to the crate's documentation. Good First Issue Issues that would be a good starting point for a new contributor. Type: Bug Problems with the code/documentation that need to be fixed.

Comments

@ctzcs
Copy link

ctzcs commented Dec 30, 2024

    /// Projects a point from world co-ordinates to camera co-ordinates.
    pub fn project(&self, point: Vec2<f32>) -> Vec2<f32> {
        let mut proj = Vec2::new(
            (point.x - self.viewport_width / 2.0) / self.scale.x,
            (point.y - self.viewport_height / 2.0) / self.scale.y,
        );

        proj.rotate_z(-self.rotation);
        proj += self.position;

        proj
    }

This function in Camera.rs seems trans point from screen to world, why is from world to camera? Is this a mistake?

@17cupsofcoffee 17cupsofcoffee added Type: Bug Problems with the code/documentation that need to be fixed. Area: Documentation Issues related to the crate's documentation. Good First Issue Issues that would be a good starting point for a new contributor. labels Dec 30, 2024
@17cupsofcoffee
Copy link
Owner

Yeah, I think you're right, screen to world (and vice-versa) would make more sense here. Not sure if it's a mistake or just badly chosen terminology (I have a feeling I meant 'world' as in 'the world outside the camera' when I wrote it, which is stupid in hindsight). Either way, it should probably change.

Will fix when I get chance 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Issues related to the crate's documentation. Good First Issue Issues that would be a good starting point for a new contributor. Type: Bug Problems with the code/documentation that need to be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants