- Изменено
Pixels Per Unit Calculation
Hi!
My game has 256 Pixels per Unit everywhere.
What is the correct scale at which I should import my skeletons to get the same bone/sprite proportions as when editing in Spine?
I thought it's 1/256 = 0.003906. The proportions are close but seem off comparing to what I see in Spine (with no offsets in Spine or Unity for comparison).
Would it be possible to change that scale input field from decimal units to the same PPU type input Unity uses? Or at least something more intuitive/human readable?
Thanks!
Edit: Since I'm here and my math is terrible my brain just stopped working but I have to finish this.
If in this particular case I have an offset of "30" in Spine, for example, how do I calculate the equivalent offset in Unity?
Ravenmore написалI thought it's 1/256 = 0.003906. The proportions are close but seem off comparing to what I see in Spine (with no offsets in Spine or Unity for comparison).
1 / PPU
(1 / 256
in your case) is correct.
It should not be off however. Could you show what your expected result vs. actual result are?
Please note that any scale, rotation, etc at nodes in Spine will alter your outcome and need to be reflected in your calculations.
Ravenmore написалWould it be possible to change that scale input field from decimal units to the same PPU type input Unity uses? Or at least something more intuitive/human readable?
You are right about that. Unfortunately we did not get to improve this input field yet due to many tasks with higher priority.
Ravenmore написалIf in this particular case I have an offset of "30" in Spine, for example, how do I calculate the equivalent offset in Unity?
If you have 256 px / unit
and have an offset of 30 px
, then that's an offset of 30px / (256 px / unit) = 30/256 units
.
That's why math is cool, it helps you creating games .
1) I'm a tard, it's simple math. Thank you for the explanations
2) I've double-checked using pixel grids, it works 100% correctly with the values calculated with this method.
3) The problems were on my side with some offset calculations in Unity when attaching stuff using BoneFollowers, after correcting those everything is A-OK.
Thank you for your patience with my mathlessness (is that a word? I guess now it is).
Cheers!
Great to hear you've figured it out!
It can be quite helpful to add the units after the numbers, it's a kind of trick to better see what values you have and where you want to get to.