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)
- WebGLRenderer.setSize cannot set properties of undefined (setting 'width') HOT 2
- Enhance target type for SpotLight and DirectionalLight HOT 1
- Build a grid through custom coordinates HOT 1
- `.equals` in class `Spherical` HOT 6
- FBXLoader loads default Unreal model with wrong rotation HOT 4
- Editor can't import glTF with .ktx2 textures HOT 1
- MRT needs a filter if there are several objects with different shader counts in the scene HOT 3
- File Export Whole Scene feature was removed 😨 HOT 2
- RectAreaLight passes through material HOT 6
- Editor: drop event in UIOutliner of ui.three.js not being call HOT 9
- Editor: Export GLB and GLTF fails to fetch HOT 2
- MeshToonMaterial support for WebGPU
- why my scene can not showed fully, after wheel scale and drag? who can help me? thanks HOT 1
- Black/gray outline shows around transparent textures when mipmaps are used. HOT 4
- MeshPhysicalMaterial: Wrong blending with nested transmissive objects. HOT 11
- Add StorageBufferAttribute to current version of Three.js HOT 1
- Stencil params getting out of sync. HOT 6
- GLTFLoader does not load external ktx2 textures HOT 5
- Material copy function issue HOT 1
- Clipping is not correct when material enables transparent and spot-light casts shadow [WebGPU] 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.