dimanche 26 novembre 2017

glowing object tin three.js

I am trying to create a textGeometry in three.js and for some reason it just isn't showing. Also i have looked at other three.js text examples and they just don't show after i use the same method. My code is below thanks.`

var loader = new THREE.FontLoader();

loader.load( 'fonts/helvetiker_bold.typeface.json', function ( font ) {

var textGeo = new THREE.TextGeometry( "My Text", {

    font: font,

    size: 50,
    height: 50,
    curveSegments: 12,

    bevelThickness: 2,
    bevelSize: 5,
    bevelEnabled: true

} );

textGeo.computerBoundingBox();

var centerOffset = -0.5 *(textGeo.boundingBox.max.x - textGeo.boundingBox.min.x)
var textMaterial = new THREE.MeshPhongMaterial( { color: 0xff0000 } );

var mesh = new THREE.Mesh( textGeo, textMaterial );
mesh.position.set( centerOffset, 400, 0 );

var group = new THREE.Group();
group.add(mesh);

scene.add( group );

Please any idea would help. Thanks:).`




Aucun commentaire:

Enregistrer un commentaire