Hi
I need put text e.g. “sun” on a 3d model, then , change text “sun” by “moon” , without using textures jpg, png … I’ve looked at “TextNode” but apparently you can not. Is there any way to do this?
thank you!
You can use TextNode for this. What is the problem you’re having with TextNode?
OK Thanks! this code works well:
self.t="123456789"
self.text= TextNode('text')
self.text.setText(self.t)
self.text.setTextColor(1,0.8,0,1)
self.text3d = NodePath(self.text)
self.text3d.reparentTo(render)
self.text3d.setScale(2,2,2)
self.text3d.setPos(0,0,0)
self.text3d.setTwoSided(True)
Now I want to put my text in the faces of Cube.egg. How can I do?
self.myCube = loader.loadModel('models/Cube.egg')
self.t="123456789"
self.text= TextNode('text')
self.text.setText(self.t)
self.text.setTextColor(1,0.8,0,1)
..............................
..............................
..............................
THANKS!
You will simply need to reposition your TextNode to be on top of one of the cube faces.
Alternatively, you may need to extract the text as a texture and apply that onto the cube, which should be possible, but I don’t know how to do that.
You can try reparentTo whatever your character is and position it on your characters face.
-
self.text.reparentTo(self.myCube) —> No attribute ‘reparenTo’
-
self.text3d.reparentTo(self.myCube)—> text appears above the model.
Well, after step (2), you simply need to tweak the values for setPos such that the text appears at the right location relative to your model.