Track camera rotation

Anonymous 10 years ago 0
This discussion was imported from CodePlex

ejleigh wrote at 2012-05-31 16:17:

This is a great project! Many thanks.

I have 3D labels that sit above the scene models. I want the labels to rotate when the camera is rotated so the labels always face the camera. This should occur as the rotation is taking place - not just at the end. Is there an easy way to accomplish this?

objo wrote at 2012-05-31 21:04:

See the "Billboard" and "Overlay" examples in the "Example browser". The billboard text has an issue when spinning the camera (this is not a problem with billboard images) - have not figured that one out yet. The "Overlay" example uses TextBlock elements over the 3D viewport - in some cases this can be the best way to show labels.

ejleigh wrote at 2012-06-12 02:30:

Thanks! This worked well. There is one unexpected behavior that I saw that may be obvious to many but not to a novice like myself. It seems that the backgound material of the billboard cannot be set and it uses the material of most distant object in the Z plane. In many cases, when using this control as a label and not necessarily as a billboard you would want the text to show up with a transparent background. Adding this line to the example xaml after all the TextBillboardVisual3D objects are created will illustrate the problem.  <ht:BoxVisual3D Fill="Chocolate" Center="0,0,0" Length="20" Width="10" Height ="20"/> As you rotate the labels overtop of the box the white background of the view shows through. The only way I found to control this so the labels appear to have a transparent background is to ensure the labels are always added to the end of the visual tree. Perhaps there is a better way?