I've created a cylinder and I want to move its center of rotation to one of its ends by changing it's bounding box but its not working.
http://jsfiddle.net/736a7/1/
There's an example of what I've been working on.
Basically I want to rotate the cylinder around as if it was a sword being swung by it's handle.
Found out thanks to some help.
geometry.applyMatrix( new THREE.Matrix4().makeTranslation(x, y, z) );
using that I translated the cylinder's y by 100 points so it basically rotates on it's lower end.
I took an approach using pivots in my case. Basically, you create a pivot point:
var pointToRotateAround; var objectToRotate; ... var pivot = new THREE.Object3D(); pivot.position=pointToRotateAround.position; pivot.add(objectToRotate); scene.add(pivot); ... function render (){ pivot.rotation.z +=0.05; } ...
It gives the possible ways to make one body rotate around another or any point. Here is more about that approach: https://github.com/mrdoob/three.js/issues/1830
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With