Advanced billboards?

Since I’m a bit lazy with my modelling, would it be possible to just use an advanced billboard instead of models? Advanced billboards are like normal billboards but they change their texture depending on their angle.

I think my code would be something like this, but I need someone to help me out a little:

def advbillboard(task):
  mybillboard.lookAt(camera)
  mybillboard.setP(0)
  if mybillboard.getH() < 45:
    mybillboard.setTexture(billboardtex[0], 1)
  elif mybillboard.getH() < 90:
    mybillboard.setTexutre(billboardtex[1], 1)
  elif mybillboard.getH() < 135:
    mybillboard.setTexture(billboardtex[2], 1)
  elif mybillboard.getH() < 180:
    mybillboard.setTexture(billboardtex[3], 1)
  elif mybillboard.getH() < 225:
    mybillboard.setTexture(billboardtex[4], 1)
  elif mybillboard.getH() < 270:
    mybillboard.setTexture(billboardtex[5], 1)
  elif mybillboard.getH() < 315:
    mybillboard.setTexture(billboardtex[6], 1)
  else:
    mybillboard.setTexture(billboardtex[7], 1)
  return Task.cont

Instead of:

mybillboard.lookAt(camera)
mybillboard.setP(0)

Consider:


mybillboard.headsUp(camera)

which achieves the same thing, more simply.

To get the heading relative to the camera, try this:


h = mybillboard.getParent().getH(camera)

Then use the value of h in your if block. Note that the range of h is -180 to 180.

We have to ask for the rotation of the billboard’s parent node, not the billboard itself, because we have already rotated the billboard to face the camera.

David

Well, i just tried it… It looks like the people in SimCoaster – Very weird looking… But it’s good for programmers – They only want to program, no modeling for them.