Hi, I’m new to panda3D, or generally game engine.
This should be a very basic question: Will the text still be shown if the TextNode is reparented to an object, not the render itself?
I loaded a card model(Card.glb), reparented it to the render, then loaded the blue mana crystal model(Mana.glb), and reparented it to the card model, it shows up at the top left corner.
Then I called the attachNewNode() method, in order to reposition the text, and here comes the issue:
1.When I make self.render invoke attachNewNode(), the text shows up correctly
2.When I make card invoke attachNewNode(), the text doesn’t show up.
The code is as follows:
card = self.loader.loadModel("Models\\SpellModels\\Card.glb")
card.reparentTo(self.render)
card.setPos(0, -3, 0)
"""Mana display of the card"""
mana = self.loader.loadModel("Models\\SpellModels\\Mana.glb")
mana.reparentTo(card)
manaText = TextNode("mana")
manaText.setText('1')
manaTextNode = self.render.attachNewNode(manaText)
manaTextNode.setScale(2)
manaTextNode.setPos(0, 0, 0)
manaText.setAlign(TextNode.ACenter)
The above code gives me the result:
When I change “self.render” to “card” in manaTextNode = self.render.attachNewNode(manaText)
, then the number ‘1’ is gone.
Does the TextNode have to be parented to the render, or am I missing something?
Any comment is appreciated : )