Comments (19)
Depending of what you're after you could just offset all the vertices instead.
But I agree, having a pivot could be useful. I haven't had a chance to implement yet (there have been some branches that implemented that, plus hierarchy, but haven't had a chance to properly merge them and test it yet).
from three.js.
Yes hierarchy is also a good addition. Could you please point me to the brances that actually implement pivot and hierarchy
from three.js.
Why has this been closed? Hierarchy will be an essential feature moving forwards although I cannot find any trace of support yet...correct me if I am wrong.
I'll open an issue for Hierarchy
from three.js.
A workaround was suggested. I think it was via twitter :S
from three.js.
I had a quick search but couldn't find anything relevant. Do you remember what was suggested?
from three.js.
Basically, offset the vertices instead. If you want the pivot to be at 100,0,0... offset all the vertices -100,0,0. Not an ideal solution but is a good workaround and saves a bunch of computations.
from three.js.
Hey i am back on it after a while but seems like offseting vertices is not a good idea if you want alot of objects rotating on a same pivot.
from three.js.
Have you tried grouping them?
Take a look at examples/webgl_geometry_hierarchy.html
from three.js.
So basically children and parent properties are used to define hierarchy?? Can two parents have same children?
from three.js.
Yes and no.
from three.js.
Still the problem remains how to define pivot of group. I am trying to make a rubik's cube I can now changing grouping of small groups according to mousemove vector but pivot of each group still giving problem.
from three.js.
That's an interesting use case.
Wouldn't the pivot be the center of the group?
from three.js.
The pivot is pivot of object first in the group and not the center.
from three.js.
http://dl.dropbox.com/u/13195512/rubik/rubikscube.html you can check if its done wrong way here.
from three.js.
Hope this illustrates:
var group = new THREE.Object3D();
var geometry = new Cube( 10, 10, 10 );
var material = new THREE.MeshBasicMaterial( { color: 0x00ffff } );
var cube1 = new THREE.Mesh( geometry, material );
cube1.position.x = 30;
cube1.position.z = 30;
group.addChild( cube1 );
var cube2 = new THREE.Mesh( geometry, material );
cube2.position.x = 30;
cube2.position.z = - 30;
group.addChild( cube2 );
var cube3 = new THREE.Mesh( geometry, material );
cube3.position.x = - 30;
cube3.position.z = - 30;
group.addChild( cube3 );
scene.addObject( group );
group.rotation.y += 0.5;
from three.js.
Yes that is ok if i want the pivot to be fixed but as you can imagine pivot and group in case of rubik's cube would be dynamic
from three.js.
i have a wind turbine. i want to rotate the wind turbine. wind turbine is a 3d object. when i am trying to rotating it is getting displaced from it center. the rotation is not perfect. it maybe an issue with my pivot point. pls help
var pointToRotateAround;
var objectToRotate;
var pivot = new THREE.Object3D();
//loading 3d turbine
var loader = new THREE.JSONLoader();
loader.load("model/fan.js", handle_load11);
function handle_load11(geometry){
fan1 = new THREE.Mesh(geometry, material);
fan1.scale.set(8,8,8);
position=fan1.position;
var box = new THREE.Box3().setFromObject( fan1 );
geometry.applyMatrix( new THREE.Matrix4().makeTranslation(position.x, position.y, position.z) );
box.center( fan1.position ); // this re-sets the mesh position
fan1.position.multiplyScalar( -1);
var axis = new THREE.Vector3(-0.5 ,0, 0 )
pivot.position= axis;
//pivot.position=fan1.position;
pivot.add(fan1);
scene.add(pivot);
}
//rotating turbine
pivot.rotation.x += .2;
from three.js.
@shravanimmy Please use the forum or stackoverflow for help requests.
from three.js.
ummm...
from three.js.
Related Issues (20)
- Issue: Object3D `.attach()` emits `added` too early
- Feature request: Optimizes Object3D `.attach()` HOT 1
- LWO Loader fails to add child if parent index is greater than child's
- Bad uv mapping when import model... HOT 1
- Computer shaders cannot load textures that they have previously created themselves HOT 10
- STLLoader does not load my STL files properly HOT 2
- `MeshPhysicalMaterial.sheenColor` says it defaults to `0xffffff` in the docs, but seems to default to `0x000000` HOT 1
- 3D model with transparent material rendered incorrectly HOT 3
- LightProbeGenerator: WebGL error with gl.readPixels in some cases HOT 7
- shGetIrradianceAt produces negative values HOT 6
- More demos HOT 7
- Utils/build/rollup.config.js: Minified builds have wrong sourcemaps generated
- SVGLoader pointsToStroke incorrect result using linecap square HOT 2
- SVGLoader pointsToStroke incorrect results when linejoin set to bevel HOT 2
- The "height" attribute should be "length"
- Incorrect normal map with material.side = THREE.DoubleSide + flatShading = true
- Improving quality of rough environmental reflections HOT 14
- WebGL renderer crashes when Mesh object uses an array of Node Materials HOT 6
- Update documentation to use MathML HOT 1
- copyExternalImageToTexture in WebGPUBackend is missing flipY HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three.js.