Jump to content

Transparency Sprite2D - Canvas2D


TheTrope
 Share

Recommended Posts

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 !

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

@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 :)

Link to comment
Share on other sites

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.
         */
 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...