Search the Community
Showing results for tags 'rotatearound'.
-
Hi together, can someone explain me the behaviour of the following: Step 1: creation of 4 boxes: let box = new BABYLON.MeshBuilder.CreateBox("0", 1, scene); let box1 = new BABYLON.MeshBuilder.CreateBox("1", 1, scene); let box2 = new BABYLON.MeshBuilder.CreateBox("2", 1, scene); let box3 = new BABYLON.MeshBuilder.CreateBox("3", 1, scene); box1.position = new BABYLON.Vector3(7,0,0); box2.position = new BABYLON.Vector3(8,0,0); box3.position = new BABYLON.Vector3(9,0,0); Step 2: now lets group boxes 1, 2 & 3 and apply rotateAround: box3.setParent(box2); box2.setParent(box1); box1.rotateAround(new BABYLON.Vector3(7,0,0),BABYLON.Axis.Y,Math.PI/2); For me it seems that the grouped boxes are moved to (0,0,0) after the rotation. Or am I getting something wrong? See your self: https://playground.babylonjs.com/indexStable.html#T99QF6#1 --> Also: I want to create two abstract methods (1) Rotate an arbitrary mesh (having children) around it's "Center". (2) Position an arbitrary mesh (having children) sucht that it's top left corner is at some target coordinates. I always encounter problems with getting the current Boundingbox (even if I calculate it recursively by merging the bounding boxes of the children). I almost feel like I am not understanding something entirely. How would you implement such a method? Thanks for helping ;)
- 2 replies
-
- rotate
- rotatearound
-
(and 1 more)
Tagged with: