Comments (9)
Ah, yup that is totally it. I thought translating 0.01
to 0.032
made sense because I was unsure of how you arrived at 0.01
in the first place. But 1/32 gives me a value of 0.03125
, which scales quite nicely.
Thanks so much for you help, I had obviously been staring at this too long today as you can tell by me poking around the code. 😄
At the very least this issue will hopefully allow people to Google the correct Tiled2Unity vertex scale for a 32x32 tile.
from tiled2unity.
I also looked at the source code to see if I could find the source of the "drift".
public static Vector3D PointFToUnityVector(PointF pt)
{
// Unity's coordinate sytem has y-up positive, y-down negative
// Apply scaling
PointF scaled = pt;
scaled.X *= Program.Scale;
scaled.Y *= Program.Scale;
// Have to watch for negative zero, ffs
return new Vector3D(scaled.X, scaled.Y == 0 ? 0 : -scaled.Y, 0.0f);
}
Could the conversion from a float
to a double
here be responsible? When 0.032f
is converted to a double
it would result in 0.0320000015199184
(see http://csharppad.com/gist/5cf382820ae0d538233d). That is such a minor difference that I am not sure if it would have an affect, but it was one thing that stood out at me after briefly looking at the source.
from tiled2unity.
Hi James, I'm away from my desk but shouldn't the scale factor be 1/32 instead of 32/100?
1/32 == 0.3125, a very nice number to represent in floating point.
Best,
Sean
Sent from my iPhone
On Aug 26, 2015, at 3:52 PM, James F McMahon [email protected] wrote:
I'm attempting to export a tiled map made up of 32x32 tiles to a Unity so that I get 1 tile == 1 unit. I'm using a vertex scale of 0.032 and am running into some trouble. The scale of the map appears to "drift" and misalign with Unity's scale.
Here is what my tiled map looks like for reference, this is a 16x16 map made up of 32x32 tiles:
And here is the imported map (some of the mesh renderers on the more colorful layer are turned off):
If you look closely, the scale of each tile doesn't appear to be consistent. So while it appears to be mostly aligned in the upper left (note the grid lines):
By the time you get to the upper right, the grid lines no longer match:
I am fairly new to Unity and just started using Tiled2Unity the other day so there is a chance that my vertex scale is just off but it seems like based on your article the proper scale for 32x32 should be 0.032.
Any help is welcome.
—
Reply to this email directly or view it on GitHub.
from tiled2unity.
Hi guys, i was searching for a similar issue and google led me here.
Have you managed to solve your problems? I have a 16px tileset and seems like it is not possible to have float values with more than two decimals places on Tiled. How did you manage to scale your map by 0.03125 when importing it to unity?
from tiled2unity.
So it's been a long time since I looked at any of this stuff but I believe it should be 1/16 or 0.0625
for a 16px tileset.
from tiled2unity.
Yeah. My issue is that when setting a custom property in tiled, i either have to live with 0.06, or 0.07.
I know this is a Tiled issue and not a Tiled2Unity, but i wanted to know if you guys managed to circumvent this limitation.
from tiled2unity.
Oh I don't know. I don't remember there be a decimal place limitation. Maybe that was something that was introduced in the year since this issue was created.
Might be worth starting a new issue if you are running into trouble.
from tiled2unity.
If you guys are entering this value into Tiled2Unity then take note that I've changed Vertex Scale to "Pixels Per Unit". This way you enter the same value as you do in Unity for your Sprites.
I made this change to be consistent with Unity, especially since I was getting a lot of support emails on the subject. Keep it simple, you know?
from tiled2unity.
Thanks for the reply. I'll check this soon
from tiled2unity.
Related Issues (20)
- Error Report HOT 22
- Tileset file does not exist HOT 4
- Object reference not set as an instance while parsing layer data as Xml elements. HOT 3
- Tiled2Unity: “Object reference not set to an instance of an object” HOT 5
- After recent update: FileNotFoundException and NullReferenceException, import stalls forever
- Preview scale?
- Tiled2Unity doesn't import map with textures into Unity
- Error Finding Textures HOT 3
- Animations won't play on objects on Object Layers HOT 5
- Tiled2Unity exports only .xml and creates no prefab / Preview complains about index out of range HOT 2
- "The object you are trying to replace does not exist or is not a Prefab." HOT 6
- Unity Android and Tiled2Unity Blurred Textures Issue HOT 2
- ICustomTiledImporter not called
- Warning: Rectangle has no width/height HOT 2
- Importing map problem. Getting error missing texture HOT 4
- Issue HOT 2
- Vertex numbers in meshes changing into "Infinity" or "NaN" after export HOT 2
- After i export a map with tiled i find it on prefab HOT 1
- How do i fix these compiler errors? HOT 1
- Tiled- why does it say it cant find my files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiled2unity.