Pawn class

Pawn is a small object that can be inserted into scene dynamically.

Signature:

export default class Pawn extends Entity 

Extends: Entity

Example 1

var pawn1 = new Modelo.Scene3D.Pawn("pawn1", viewer.getResourceManager(), viewer.getMaterialManager());
pawn1.createSolidCube();
pawn1.setScaling(40, 40, 1.0);
viewer.getScene().addPawn(pawn1);

Example 2

var image1 = new Image();
image1.src = "/chessboard.jpg";
image1.onload = function() {
   var pawn2 = new Modelo.Scene3D.Pawn("pawn2", viewer.getResourceManager(), viewer.getMaterialManager());
   pawn2.createTexturedQuad([image1]);
   pawn2.setScaling(40, 40, 1.0);
   pawn2.setTranslation(0, 0, 1.01);
   viewer.getScene().addPawn(pawn2);
}

Constructors

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

Methods

MethodDescription
clone(name)Clone functin of the pawn object.
createSolidCube(color)Create a solid cube in given color.
createTexturedQuad(images, options)Create a textured cube in given color.
destroy()Destroy the pawn.
getSkeletons()Get the skeletons of the loaded pawn. Every pawn can have multiple skeletons and every skeleton can have multiple animations (call skeleton.getAnimations() to get them).
setDiffuseColor(color)Set the diffuse color of the pawn.
setOpacity(opacity)Set the opacity of the pawn