Passing paramiter values to three.js via vars (or php echo) causes undesired results

When I pass the values to three.js like so.. const paintgeom = new THREE.CylinderGeometry(2.5, 1.5, … Read more Passing paramiter values to three.js via vars (or php echo) causes undesired results

When I pass the values to three.js like so..

const paintgeom = new THREE.CylinderGeometry(2.5, 1.5, 3.3, 240, 1, true);

The result looks like this (all is as expected)..

enter image description here

However if i pass the same as a var like so..

var trad = '2.5';
const paintgeom = new THREE.CylinderGeometry(trad, 1.5, 3.3, 240, 1, true);

I get very weird ‘pinch’ or ‘hourglass’ type results like this..

enter image description here

I have also tried passing the params as a php echo but get the same odd result?
How can I pass these numbers to the script and not have to hard code them in please?

I have also put the complete code on JSFiddle
https://jsfiddle.net/StickerMonkey/ov12fh3s/53/

Source: JavaSript – Stack Overflow



Leave a Reply

Your email address will not be published. Required fields are marked *