rahulng

Scaling sprites from unity to Phaser using .json

Recommended Posts

Hey guys,Ive been working on making a level editor in unity and then storing the resultant transform information like scale,position and rotation in a.json file to be read by phaser.while the position and rotation work perfectly well by changing the pivot of the sprites in unity.the scale doesnt seem to work ie the scaling in unity doesnt show the same result in phaser.if anyone has suggestion on how to calibrate it please let me know.

Share this post


Link to post
Share on other sites

unity code

 

double turret_scale_x=(turret_reference[index].transform.localScale.x-standardscale)/2;
            double turret_scale_y=(turret_reference[index].transform.localScale.y-standardscale)/2;
            if(turret_scale_x<=1)
                turret_scale_x=1;
            if(turret_scale_y<=1)
                turret_scale_y=1;

 

m.AddField("scalex",(float)turret_scale_x);
            m.AddField("scaley",(float)turret_scale_y);

 

original scale value=6.5

changed to:18.65

 

but wen i use thes same stats in phaser

using the scaleto(12,12,'turret');

 

it makes the thing HUGE,far bigger than the unity output

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.