Change origin of billboard effect, TextNode positioning


I’m trying to setup tooltips for 3d objects in the world. Therefore, I created a TextNode and attached it to a NodePath. Then I added the billboard effect with setBillboardPointEye().

text = TextNode('xx/nxx/nxx/nxx/n')
nodepath = aspect2d.attachNewNode(text)

Unfortunately, the tooltip appears to rotate around some point right between the first and the second line of the text (there are around 5-10 lines of text). I’d rather have it rotate around the bottom edge or something like that. If I change the position of the NodePath itself and the camera then turns around the tooltip, it still rotates around this point between the first and the second line. Just the whole TextNode was shifted to some other global coordinate. Is there an easy possibility to somehow shift the origin of the billboard effect respectively the origin of the TextNode?


In the screenshot you can see that there are two tooltips that are fixed at the (light) blue dot, right between the first and second line. How does Panda3d decide to position the TextNode like this and how can I change this without having to do coordinate transformations relative to the camera when positioning the NodePath?

If you are trying to attach hints in a 3d world, then attach them to the render.
Since the aspect2d is an ortho lens camera, and in addition it is a cartesian coordinate system.

You simply need to put the text on a child node and apply a position offset to this child node, while the billboard effect is applied to the parent node.


Thanks for the reply! (Also sorry for my late reply.)
Reparenting the node was the solution for my problem. But still I wonder why the “mounting point” of the TextNode is right below the first line. Is this associated with the line height? If I want to mount it at the corner of the TextNode I have to shift it upwards by .7 or something.

It does seem like a TextNode has its origin at the baseline of its text.

Perhaps the TextNode.get_bottom or TextNode.get_top methods might be of help to you.


Yeah, I assumed so too. But I feel like it is kind of weird that the origin is set at the bottom of the first line and not at the bottom of the whole node.
But I’ll try out the getBottom/getTop methods. Thank you for the hint!

1 Like