Ner Posted August 5, 2016 Share Posted August 5, 2016 I tried to add a sprite2d(scaleX 0.5) to ScreenSpaceCanvas2D,,,if the texture didn't load, it will like this,,position.x is correct. but when the texture loaded,,it mostly like this ,,position.x still thinks scaleX is 1. The first picture is suitable,,,,but I want to preload texture,,, Quote Link to comment Share on other sites More sharing options...
Ner Posted August 5, 2016 Author Share Posted August 5, 2016 Is there some way to fix it? Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 5, 2016 Share Posted August 5, 2016 playground ? Quote Link to comment Share on other sites More sharing options...
Ner Posted August 6, 2016 Author Share Posted August 6, 2016 texture not load http://playground.babylonjs.com/#1WE7TW#0 texture loaded http://playground.babylonjs.com/#1ZRGGC#1 The position is different. Quote Link to comment Share on other sites More sharing options...
Ner Posted August 6, 2016 Author Share Posted August 6, 2016 @Nockawa @Nabroski Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 6, 2016 Share Posted August 6, 2016 Hello i think Nockawa will have a look at this problem soon. I don't know, what's the problem is with texture task, maybe you have to first change some default properties of the texture. i load my images in binary and never face any problems, I also like to have the ability to change properties of my textures like samplingmode easilyhttp://playground.babylonjs.com/#1ZRGGC#3 Best Quote Link to comment Share on other sites More sharing options...
Nockawa Posted August 11, 2016 Share Posted August 11, 2016 On 05/08/2016 at 3:30 PM, Ner said: I tried to add a sprite2d(scaleX 0.5) to ScreenSpaceCanvas2D,,,if the texture didn't load, it will like this,,position.x is correct. but when the texture loaded,,it mostly like this ,,position.x still thinks scaleX is 1. The first picture is suitable,,,,but I want to preload texture,,, Hello @Ner I'm on holidays right now and have limited working time, but I'll try to find some time tonight to work on your issue. I told @MasterK that non uniform scale would cause issue, looks like I was right! Anyway I'll fix it. Here is the Trello Card corresponding to the bug. Quote Link to comment Share on other sites More sharing options...
MasterK Posted August 11, 2016 Share Posted August 11, 2016 4 minutes ago, Nockawa said: Hello @Ner I'm on holidays right now and have limited working time, but I'll try to find some time tonight to work on your issue. I told @MasterK that non uniform scale would cause issue, looks like I was right! Anyway I'll fix it. Here is the Trello Card corresponding to the bug. I missed your words and understand just now... Quote Link to comment Share on other sites More sharing options...
Ner Posted August 12, 2016 Author Share Posted August 12, 2016 I just found another issue http://www.babylonjs-playground.com/#BD8MQ If a sprite's parent is a group, and the sprite's marginAlignment has been set, , ,even if the sprite is in the group, group's range will also be change. Quote Link to comment Share on other sites More sharing options...
Ner Posted August 12, 2016 Author Share Posted August 12, 2016 5 minutes ago, Ner said: I just found another issue http://www.babylonjs-playground.com/#BD8MQ If a sprite's parent is a group, and the sprite's marginAlignment has been set, , ,even if the sprite is in the group, group's range will also be change. @Nockawa Quote Link to comment Share on other sites More sharing options...
Nockawa Posted August 16, 2016 Share Posted August 16, 2016 @Ner I'm on it, starting right now, I'll keep you posted. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted August 22, 2016 Share Posted August 22, 2016 Hello @Ner Sorry for answering such lately, I don't have much time to work right now, but I've found your issue and just fixed it. Let me first say that what you think for right were in fact wrong. The correct result is where the texture is already loaded, like with this PG: http://playground.babylonjs.com/#1ZRGGC#1 What was not working was when the texture was not loaded the origin wasn't apply on the Sprite2d with the texture size then it looked like this: http://playground.babylonjs.com/#1WE7TW#0 Why you got it wrong? Because the default origin for a Sprite2d will be 0.5, 0.5 which means if you apply a scale of 0.5 your Sprite2d will be vertically shrink by half and centered. If you set an origin of 0, you will get the result you're looking for and this will work in both modes with the latest release I've just pushed (note that the latest preview of bjs doesn't include it, you have to get the code from the official repo and recompile it). The origin will work for scale/rotation of a primitive, per default the 0.5 value means it's centered, you can set left/bottom by setting 0, right/top by setting 1. Let me know if there's something not as clear as it should be. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted August 26, 2016 Share Posted August 26, 2016 On 12/08/2016 at 5:22 AM, Ner said: I just found another issue http://www.babylonjs-playground.com/#BD8MQ If a sprite's parent is a group, and the sprite's marginAlignment has been set, , ,even if the sprite is in the group, group's range will also be change. Hello @Ner , I took a look at your PG, as I explained in another post (that I can't find again), when you're using the Positioning Engine (margin, alignment, padding) you must not set the x/y/position properties of your primitive, the result will be something unexpected... Is this the cause of your issue? If you remove the x/y properties and rely on margin instead, will it solve it? Take a look at this doc (which I recently updated to make this clearer) for more info: http://doc.babylonjs.com/overviews/Canvas2D_Prim_Positioning Tell me if something is still not clear enough. Quote Link to comment Share on other sites More sharing options...
Ner Posted August 26, 2016 Author Share Posted August 26, 2016 I see,,,thanks @Nockawa Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.