Transforms under aspect2d, how do they work?


I wish to display short lines of text on the screen. I thought of creating a ‘text_group’ node under aspect2d, and reparent all my textnodes to that ‘text_group’ node. That way, I just have to call text_group.setPos to choose where all my lines appear.

    text_group = self.aspect2d.attachNewNode('text_group')
    text_group.setY(.5) # Move it up away from the center.
    text = OnscreenText(text="Hello",
    # `text` should appear half-way between the top and the center
    # of the screen.

Except that I can’t get it to work… I can move text_group all I want, the text still shows relative to (0, 0), the center of the screen. It’s as if the node transforms didn’t apply. It doesn’t matter whether the textnode is created with ‘mayChange=True’ or ‘mayChange=False’.

How does that work?

Forget it. A typo showed me my error: panda3d is Z-up, not Y-up. I don’t know why I assumed that on render2d, the coords would be xy.

Solved! :blush: