Skip to content

how to apply Pixi.Text texture to the face of a cube? #146

Answered by jnsmalm
ChristieLukose asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

The easiest way to achieve this is to have a cube mesh and a separate face with the text texture (you can use Sprite3D for this).

let box = app.stage.addChild(Mesh3D.createCube())

let sprite = box.addChild(new Sprite3D())
sprite.z = 1.01 // The size of the box plus a small amount to avoid z-fighting.

let text = new Text("This is regular\nPixiJS text")
text.updateText(false)

sprite.texture = text.texture

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ChristieLukose
Comment options

Answer selected by ChristieLukose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants