Rotating around the center.

Is it possible to set a center on a card created by a CardMaker? It now positions and rotates the card from the top left corner, I would like to change that so that the position and rotation is relative to the card’s middle.

DECK = CardMaker('Quad')#to generate the quad with
DECK.setFrame(-0.5,0.5,-0.5,0.5)
myQuad=DECK.generate()

This code creates a 1x1 quad with the center in the center.

Yes,
Basically make a dummy NodePath and parent it to whatever NodePath you have the card parented to.

like this:

myDummyNP = NodePath(“myDummyNodePath”)
myDummyNP.reparentTo(render2d)
#not sure if this number is right, but basically you offset from the center
myCard.setPos(0.5,0.5)
myCard.reparentTo(myDummyNP)
myDummyNP.setPos(-0.5,-0.5)
myDummyNP.setHpr(20,0,0)

That should do it.

Thanks guys. However, both these solutions seem more like workarounds. Extra nodes and having to create the card using a specific frame using 0, 0, 0 as the center, always.

There has got to be a way to say “set center in the middle of these vertices” as you can when you create models in some 3D authoring software.

See https://discourse.panda3d.org/viewtopic.php?t=2248 for example code of a working solution.