THREE.PlaneGeometry not showing

I tried playing with a textbook from an aerotist. Everything went well until I mixed up with THREE.PlaneGeometry, as the code below:

var $container = $('#container');
var WIDTH = $container.width(), HEIGHT = $container.height();
var VIEW_ANGLE = 45, ASPECT = WIDTH / HEIGHT, NEAR = 0.1, FAR = 10000;

var renderer = new THREE.WebGLRenderer();
var camera = new THREE.PerspectiveCamera(VIEW_ANGLE, ASPECT, NEAR, FAR);
var scene = new THREE.Scene();
camera.position.z = 300;
renderer.setSize(WIDTH, HEIGHT);
$container.append(renderer.domElement);

// create the mesh material
var meshMaterial = new THREE.MeshBasicMaterial({color:0xCC0000});
var mesh = new THREE.Mesh(new THREE.CubeGeometry(100,100,1,1),meshMaterial);

// add the mesh to the scene
scene.add(mesh);
scene.add(camera);
renderer.render(scene, camera);

When I change the line from

var mesh = new THREE.Mesh(new THREE.CubeGeometry(100,100,1,1),meshMaterial);

to

var mesh = new THREE.Mesh(new THREE.PlaneGeometry(100,100,1,1),meshMaterial);

or

var mesh = new THREE.Mesh(new THREE.PlaneGeometry(100,100),meshMaterial);

Then nothing is displayed. What's wrong?

+3
source share
2 answers

It is possible that it is not two-sided or that you cannot see it at the current angle, check this js script for rotating the plane and play with it in practice.

EDIT:

It seems that the plane is facing down so that the camera cannot see it, I changed mesh.rotation.xit to prove what it is doing.

See - updated example

+3
source

- , ; , ( , ) 0 NaN.

0

All Articles