nickandmiles / dat-gui

Automatically exported from code.google.com/p/dat-gui
0 stars 0 forks source link

change radius of THREE.SphereGeometry with slider #41

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
http://mrtn.ch/3D/13_06_27_gui_03.html

What steps will reproduce the problem?
1. move Radius slider, nothing happens

What is the expected output? What do you see instead?

Want to use dat-gui sliders to change the radius of the sphere and later also 
other properties such as segments or thetaLength...

Sphere is generated based on variables but I don't know how to update these 
variables?

What version of the product are you using? On what operating system?

http://stemkoski.github.io/Three.js/js/DAT.GUI.min.js / mac os x 10.6.8 / 
safari, chrome

Please provide any additional information below.

Can't figure out how to do it, thanks for your help.

Original issue reported on code.google.com by thisism...@gmail.com on 27 Jun 2013 at 11:37

GoogleCodeExporter commented 8 years ago
This is more of a threejs issue. The parameters on the sphere geometry do not 
update the geometry when changed. You probably want to replace "radius = value" 
in your onChange fnuction to:
sphere.geometry = new THREE.SphereGeometry (value, segmentsWidth, 
segmentsHeight, phiStart, phiLength, thetaStart, thetaLength );
sphere.geometry.verticesNeedUpdate = true;

Original comment by max.stra...@gmail.com on 1 May 2014 at 1:37

GoogleCodeExporter commented 8 years ago
Won't it be cheaper to scale the mesh rather than create a new geometry?

Original comment by lee...@gmail.com on 24 Oct 2014 at 1:24