Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
add px_offset_x and px_offset_y to to_world
Browse files Browse the repository at this point in the history
  • Loading branch information
joshvera committed Dec 27, 2023
1 parent 11219ae commit 6acbdd7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion comfy-ldtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ impl LdtkLayerExtensions for LayerInstance {

fn px_to_world(&self, position: Vec2) -> Vec2 {
let grid = self.grid_size as f32;
let px_offset_x = self.px_total_offset_x as f32;
let px_offset_y = self.px_total_offset_y as f32;

vec2(position.x / grid, self.c_hei as f32 - position.y / grid - 1.0)
vec2((position.x + px_offset_x) / grid, self.c_hei as f32 - (position.y + px_offset_y) / grid - 1.0)
}
}

Expand Down

0 comments on commit 6acbdd7

Please sign in to comment.