Home > @modelo.io/api > PawnBillboard

PawnBillboard class

A billboard pawn that always faces camera.

Signature:

export default class PawnBillboard extends Pawn 

Constructors

ConstructorDescription
(constructor)(name, resourceManager, materialManager)Constructs a new instance of the PawnBillboard class

Methods

MethodDescription
createSolidQuad(color)Create a solid-colored quad.
createTexturedQuad(image)Create a textured quad.
destroy()
load(modelId)Load the model with model ID.
setFaceCameraZ(enabled)If set to false, not all axis of object will align with the camera. Only XY axis will do. It is like we look down the object at top, the object rotate to the view direction with its z axis. By default, it is enabled.

Example

for (var i = 0; i < 10; i++) {
    var plane = new Modelo.View.PawnBillboard("plane" + i, viewer.getResourceManager(), viewer.getMaterialManager());
    plane.createSolidQuad([1, 0, 0]);

    var x = Math.random() * 80 - 40.0;
    var y = Math.random() * 80 - 40.0;
    plane.setTranslation(x, y, 2.02);
    viewer.getScene().addPawn(plane);
}