TheTrope Posted November 23, 2016 Share Posted November 23, 2016 Hi ! When using two Sprite2D that overlap themselves (.png with transparency), the transparent pixels of the top one does not display the pixels of the second one. It behaves like a mask. Even overlaping a sprite2D (fully transparent png) over a rectagle 2D will make the rectangle2D to not be rendered in this area. Am i wrong or there is an issue ? Ping @Nockawa Thanks ! Quote Link to comment Share on other sites More sharing options...
Nockawa Posted November 23, 2016 Share Posted November 23, 2016 21 minutes ago, TheTrope said: Hi ! When using two Sprite2D that overlap themselves (.png with transparency), the transparent pixels of the top one does not display the pixels of the second one. It behaves like a mask. Even overlaping a sprite2D (fully transparent png) over a rectagle 2D will make the rectangle2D to not be rendered in this area. Am i wrong or there is an issue ? Ping @Nockawa Thanks ! Have you set the texture.hasAlpha = true; to each texture involved in both sprites? TheTrope 1 Quote Link to comment Share on other sites More sharing options...
TheTrope Posted November 23, 2016 Author Share Posted November 23, 2016 6 minutes ago, Nockawa said: Have you set the texture.hasAlpha = true; to each texture involved in both sprites? Well, my bad, thanks ! Nockawa 1 Quote Link to comment Share on other sites More sharing options...
TheTrope Posted November 23, 2016 Author Share Posted November 23, 2016 @Nockawa If i may ask another fast question : I want to move a Sprite2D, but nothing appends if i do: mysprite.position.x += 100, it does not work (It seems to update the vector, but the sprite do not refresh to it's new position). So i need to do mysprite.position = new BABYLON.Vector2(mysprite.position.x + 100, mysprite.position.y) to get it work, what is wrong with the first method? Thanks Quote Link to comment Share on other sites More sharing options...
Nockawa Posted November 23, 2016 Share Posted November 23, 2016 if you do ".position.x += 10" there won't be a way for me to know there were a value change in X, you have to rely on the ".x += 10" shortcut to do what you want. It's in the doc: Quote /** * Position of the primitive, relative to its parent. * BEWARE: if you change only position.x or y it won't trigger a property change and you won't have the expected behavior. * Use this property to set a new Vector2 object, otherwise to change only the x/y use Prim2DBase.x or y properties. * Setting this property may have no effect is specific alignment are in effect. */ TheTrope 1 Quote Link to comment Share on other sites More sharing options...
TheTrope Posted November 23, 2016 Author Share Posted November 23, 2016 Ohhh I see, okay thanks ! 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.