Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a custom mesh? #1318

Closed
ghost opened this issue Feb 12, 2012 · 3 comments
Closed

How to create a custom mesh? #1318

ghost opened this issue Feb 12, 2012 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Feb 12, 2012

This didn't work:

var geom = new THREE.Geometry(); 
var v1 = new THREE.Vector3(0,0,10);
var v2 = new THREE.Vector3(0,500,10);
var v3 = new THREE.Vector3(500,500,10);

geom.vertices.push(new THREE.Vertex(v1));
geom.vertices.push(new THREE.Vertex(v2));
geom.vertices.push(new THREE.Vertex(v3));
geom.faces.push( new THREE.Face3( 0, 1, 2 ) );

var object = new THREE.Mesh( geom, new THREE.MeshNormalMaterial() );
scene.addObject(object);
@mrdoob
Copy link
Owner

mrdoob commented Feb 12, 2012

var geom = new THREE.Geometry(); 
var v1 = new THREE.Vector3(0,0,10);
var v2 = new THREE.Vector3(0,500,10);
var v3 = new THREE.Vector3(500,500,10);

geom.vertices.push(new THREE.Vertex(v1));
geom.vertices.push(new THREE.Vertex(v2));
geom.vertices.push(new THREE.Vertex(v3));
geom.faces.push( new THREE.Face3( 0, 1, 2 ) );
geom.computeFaceNormals(); // your geometry needs normals if you want to use MeshNormalMaterial

var object = new THREE.Mesh( geom, new THREE.MeshNormalMaterial() );
scene.add(object); // scene.addObject is supposed to be used internally only, sorry about that.

@ghost
Copy link
Author

ghost commented Feb 13, 2012

What a fast answer. Thank you very much! Are you still working on the project? Do you need something?

@mrdoob
Copy link
Owner

mrdoob commented Feb 13, 2012

Yup!

https://github.com/mrdoob/three.js/commits/dev

Not sure what's needed to be honest... I think we just need time :D

@mrdoob mrdoob closed this as completed Feb 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant