Skip to content

fixed globalposition offset in some scenarios#31

Closed
Kernvirus wants to merge 2 commits into
sandrofigo:developfrom
Kernvirus:develop
Closed

fixed globalposition offset in some scenarios#31
Kernvirus wants to merge 2 commits into
sandrofigo:developfrom
Kernvirus:develop

Conversation

@Kernvirus

Copy link
Copy Markdown

GlobalPosition should always be at min + size / 2 so that as a developer I can always get the minimum and maxium bounds of an imported voxel file.

This should always be true:
model.GlobalPos - floor(model.Size / 2) >= voxel.GlobalPos
model.GlobalPos + ceil(model.Size / 2) < voxel.GlobalPos

This PR ensures this.

The problem is caused by insane way magica voxel handles rotations. When it rotates a model with an uneven size, it will add an invisible correction to the pivot to keep the center voxel in the same place before and after rotation. This results in of-by-one issues with the global pivot.
I sidestepped this issue by recalculating the global pivot by applying the transformation to the min and max voxel.

@sandrofigo

Copy link
Copy Markdown
Owner

Thank you for opening a PR.

I'll take a look at it as soon as possible. In the meantime, could you please remove the files in the "lfs/objects" folder?
It looks like some files or folders may have been committed by accident.

@Oribow

Oribow commented Oct 11, 2025

Copy link
Copy Markdown
Contributor

done

@Oribow

Oribow commented Oct 16, 2025

Copy link
Copy Markdown
Contributor

any update? I need this merged for my own project to continue.

@sandrofigo

Copy link
Copy Markdown
Owner

I'll have some time this weekend to look at it in detail.

@sandrofigo

Copy link
Copy Markdown
Owner

Continued in #33

@sandrofigo sandrofigo closed this Oct 17, 2025
@sandrofigo

Copy link
Copy Markdown
Owner

Changes included in v5.0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants