javascript - Dynamically change object dimensions in Three.js -
i using library dat.gui within three.js let user interact object , modify dimensions of mesh. of examples online using scale when want change mesh dimensions:
mesh.onchange(function(value){mesh.scale.x = value;}); the problem solution is not user friendly , requires adjust object.position when value changed. there other possibilities apart one? in case can post plausible alternative working example? in advance answers.
a clue solving question understand origin of object : @ object's geometric center or @ corner. depends on implementation of scale operation.
ignoring three.js minute, if done hand scale operation thought of 3 distinct operations :
1 - translate object center origin of world coordinates 2 - multiply vertex position matrix scale factor 3 - translate object original world location so 2 assumptions need resolved :
- ~center~ of object @ geographic center or @ 1 of corners - want scale (stretch) object expanding outwards origin in dimensions or extend outwards retaining current origin , ballooning shape outwards what behavior need expressed ?
.... object.position needed depending on answer
Comments
Post a Comment