# Topper

Members

22

• Rank
Member
1. ## Absolute positioning

@ JK That´s elegant. Thanks
2. ## Absolute positioning

Thanks. Seems like i should have learned sth more useful.
3. ## Absolute positioning

@ brianzinn OK, I´m still struggling with rotations. I made a simple PG with one mesh extruded from a plane: https://www.babylonjs-playground.com/#12YQ6V#1 What do I have to do, to make the mesh rotate around its CoG and not (0, 0, 0)? Thanks, Markus
4. ## Absolute positioning

brianzinn, you´re my man. That simple line of code did the trick. Can you explain to me what this exactly does? Is it like "freezing prior transformations"? I came across "setAbsolutePosition / getAbsolutePosition ". What´s the sense of this? Is the "absolute position" always in relation to the world axes? Thanks a lot, man. BR, Markus
5. ## Absolute positioning

Hi, the angels of the diagonal braces are correct and so are the braces lengths (they are still not in the middle though). Believe me. Math is not my pain. They are supposed to meet the inner side holes of the uprights and future screws. Here´s my pain: https://www.babylonjs-playground.com/#FY8S2X#2 I position seven diagonal braces along Y. I make BJS return the centers (Line 298) of each: var meshLocalCenter = braceD.getBoundingInfo().boundingBox.center; var meshWorldCenter = braceD.getBoundingInfo().boundingBox.centerWorld; For every single diagonal brace I get the same values although their positions (at least in Y) are definitely different: center: {X: 0 Y:-6.448263332091828 Z:-0.15} centerWorld: {X: 0 Y:-6.448263332091828 Z:-0.15} How´s that? Check it yourself. That´s what I´m not getting. BR, Markus
6. ## Absolute positioning

@ brianzinn Thanks, but I´m not getting it. I know that order matters, but when i move (position) my braces, their "reference points" are still (0, 0, 0). Do I my mean something else by "moving a mesh"? BR, Markus
7. ## Absolute positioning

Hi JohnK, thanks for your reply. I went throug your PG and I´ve a question on it: When I spawn a mesh like a box or a sphere it will always be in (0, 0, 0). But when i create a more complex mesh based on an extruded 2D-shape (bunch of vector2() in an array) the mesh´s reference point is still the 2D´s reference point and not the new mesh´s (3D) CoG. Since my workflow is like this: - make 2D shape - extrude 2D shape to 3D shape - perform first rotation (PI / 2 in z (world axes) - perform second rotation (calculated angle in y (world axis)) - move mesh in z (world axes) - move mesh in y (world axes) I kept sticking with the idea that it may be easier to calculate arbitrary points as "rotation axes" then using anything else. Here you can find the example I´ve been working on: https://www.babylonjs-playground.com/#FY8S2X#1 My challenge is to position the diagonal braces in between the two blue uprights. I already calculated the "rotation axes" for every singe diagonal brace (green spheres), but I keep failing in using these points as "rotation axes" My plan was to do this "pivot point thing", since a mesh's CoG is not in (0, 0, 0) when I extrude a 2D shape. Would it help to clone my mesh to get one with its CoG in (0, 0, 0)? Thanks in advance guys, Markus
8. ## Absolute positioning

Hi folks, I´ve been going through a lot of PGs and the BJS docu as well to figure out the best (most easy way) to place meshes in a scene. I still don´t understand why it´s necessary to distinguish between world space an local space, and I´ve seen a lot of posts of people struggling with the same topic. What is the easiest (and most elegant) way to position and rotate a created mesh based on one coord system (probably world) always based on a mesh´s CoG? I just want to spend a Vector3(x, y, z) and perform some rotations after, always based on a mesh´s CoG. I studied this PG, but I don´t understand why I have to do all the calcs (transformations) by myself: http://www.babylonjs-playground.com/#M0UJB Is there some standard functionality i didn´t come across yet? BR, Markus
9. ## Holes in extruded shape

Thanks JohnK, this works well. BR, Markus
10. ## Holes in extruded shape

Ok, I still Need some help, I´m using a for loop to create multiple cylinders along the main mesh´s Y-axis to cut holes using CSG. For some reasing it only cuts out the hole the last cylinder produces. I´m not sure if i´m using the wrong order of my code lines in the for loop. http://www.babylonjs-playground.com/#5KCYBZ#1 Thanks, Markus
11. ## Holes in extruded shape

Thanks folks, CSG is exactly what I need. It´s pretty straight forward, though. Unfortunately I didn´t find enough time yesterday evening to code the JS-functions to cut the needed holes over the whole mesh length. But CSG already became my new friend. ;-)
12. ## Holes in extruded shape

I already came across this and found a PG about making holes into a balling ball. Gonna have a look into this right away. thanks, Deltakosh
13. ## Holes in extruded shape

Hi everyone, I´m trying to figure out the best way to put holes in an extruded shape. What I want to get achieved is the upright of a pallet rack with hole patterns on three different sides based on user input. I want to keep effort and complexity as little as possible. I already tried two different approaches: 1) create shape, add holes, extrude 2) create shape, extrude, ??? I already went through the "house sample" in the PG, but the workflow there is kinda different: I want to define the holes (or their coordinates) after having extruded my shape. Here´s the result of my two tries. Is there a way to cut holes into an extruded shape by vector3 ccordinates? BR, Markus
14. ## Problem drawing simple Lines for a ruler

@ Pryme8 That´s awesome. Thanks a lot, man, I really appreciate it. @ Deltakosh Sounds about right. Damn, I should definitely stop coding after 16 hour. But for some reason BJS is highly addictive to me. BR, Markus
15. ## Problem drawing simple Lines for a ruler

High, no idea why BJS struggles with this code: https://www.babylonjs-playground.com/##RCZLX7 It fails when I want to push coordinates in my array in this very line: myPoints.push(new BABYLON.Vector3(shortLength, currentHeight, 1)); Here´s the code of my function; doesn't even start in PG: this.createMeshRuler = function(){ var rulerHeight = 5.000; var rulerWidth = 0.500; var sourcePlane = new BABYLON.Plane(0, 0, 0, 0); sourcePlane.normalize(); var meshRuler = BABYLON.MeshBuilder.CreatePlane("meshRuler", {height:rulerHeight, width: rulerWidth, sourcePlane: sourcePlane, sideOrientation: BABYLON.Mesh.DOUBLESIDE}, this.scene); meshRuler.position = new BABYLON.Vector3(0.5 * rulerWidth, 0.5 * rulerHeight, 0); var rulerMaterial = new BABYLON.StandardMaterial("myMaterial", this.scene); rulerMaterial.emissiveColor = new BABYLON.Color3(1, 1, 0); meshRuler.material = rulerMaterial; // Striche einfügen var restHoehe = rulerHeight; // verbleibende Höhe bis OK Ruler var currentHeight = 0; // aktuelle Höhe beim Aufbauen des Rulers var step = 0.200; // Schrittweite var stepCounter = 0; // Schrittzähler (Schleifendurchläufe) var shortLength = 0.2000; var longLength = 0.3500; Ende: while (restHoehe > 0) { currentHeight = restHoehe; // kurzen Strich if (stepCounter < 5) { var myPoints = []; myPoints.push(new BABYLON.Vector3(0, 0, 0)); myPoints.push(new BABYLON.Vector3(shortLength, currentHeight, 1)); var lines = BABYLON.MeshBuilder.CreateLines("lines", {points: myPoints, updatable: true}, this.scene); lines.color = new BABYLON.Color3(1, 0, 0); stepCounter = stepCounter + 1; currentHeight = currentHeight + step; // langer Strich }else if (stepCounter === 5) { var myPoints = []; myPoints.push(new BABYLON.Vector3(0, 0, 0)); myPoints.push(new BABYLON.Vector3(longLength, currentHeight, 1)); var lines = BABYLON.MeshBuilder.CreateLines("lines", {points: myPoints, updatable: true}, this.scene); lines.color = new BABYLON.Color3(1, 0, 0); stepCounter = 0; currentHeight = currentHeight + step; // Error }else{ /// Alert } } }; All browsers start to freeze; more or less. Any suggestions, what´s happening? BR, Markus