本文整理匯總了TypeScript中babylonjs.Mesh類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Mesh類的具體用法?TypeScript Mesh怎麽用?TypeScript Mesh使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Mesh類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(game) {
this._game = game;
this.size = 100;
const light = new BABYLON.HemisphericLight('light1', new BABYLON.Vector3(1, 2, -1), this._game.scene);
//const skybox = BABYLON.Mesh.CreateSphere('skyBox', 50, 1000, game.scene);
//skybox.layerMask = 2;
const ground = BABYLON.Mesh.CreateGround("ground", this.size, this.size, 2, this._game.scene);
this._deactivateSpecular(ground);
ground.checkCollisions = true;
ground.renderOutline = true;
ground.outlineColor = new BABYLON.Color3(0, 0, 0);
ground.physicsImpostor = new BABYLON.PhysicsImpostor(
ground,
BABYLON.PhysicsImpostor.BoxImpostor,
{ mass: 0, friction: 0.5, restitution: 0.7 },
this._game.scene
);
setInterval(() => {
var posX = this._randomNumber(-this.size/2, this.size/2);
var posZ = this._randomNumber(-this.size/2, this.size/2);
var t = new Target(this._game, posX, posZ);
}, 1000);
this.minimap = new Minimap(this._game, this.size);
}
示例2: _populateScene
/** Creates the box */
protected _populateScene() {
// Create the hdr texture
let hdrTexture = new HDRCubeTexture(this._textureUrl, this._scene, 512);
hdrTexture.coordinatesMode = Texture.SKYBOX_MODE;
this._cube = Mesh.CreateBox("hdrSkyBox", 10.0, this._scene);
let hdrSkyboxMaterial = new PBRMaterial("skyBox", this._scene);
hdrSkyboxMaterial.backFaceCulling = false;
hdrSkyboxMaterial.reflectionTexture = hdrTexture;
hdrSkyboxMaterial.microSurface = 1.0;
hdrSkyboxMaterial.disableLighting = true;
this._cube.material = hdrSkyboxMaterial;
this._cube.registerBeforeRender(() => {
this._cube.rotation.y += 0.01;
})
}
示例3: _createNode
// Mesh association
protected _createNode(scene: Scene): TransformNode {
this._currentMesh.getChildMeshes().forEach((mesh) => {
mesh.metadata = this;
});
return this._currentMesh;
}