Billboard effect question

You need two billboard effects, one beneath the other. The first one rotates the arrow’s face towards the camera. The second one is an axial billboard, to rotate the arrow around its axis to point as nearly to the target as possible, without moving the axis.

from direct.directbase.DirectStart import *
from pandac.PandaModules import *

s = loader.loadModel('smiley.egg')
s.reparentTo(render)
i = s.posInterval(5, Point3(10, 0, 0), startPos = Point3(5, 5, 5))
i.loop()

arrow = loader.loadModel('up_arrow.egg')

a1 = render.attachNewNode('a1')
a1.setP(-90)
a1.setBillboardPointWorld()
arrow.reparentTo(a1)
arrow.setP(90)
arrow.setBillboardAxis(s, 0)

The setP() calls are necessary since a billboard always rotates the Y axis to the target. But we want the second one to rotate the arrow’s Z axis to the target, which means we have to pre-rotate the arrow.

David