Search the Community
Showing results for tags 'pivotmatrix'.
-
Hi guys, I was trying to load obj meshes to the scene and for reusing them, I tried the method "createInstance". However, I can't set the matrix of each instance by assigning each mesh a "_worldMatrx". I am confused with the issue. Is there any methods for setting the mesh matrix? Sorry for the rookie question, any suggestion will be helpful. Thank you in advance.
-
This is a problem which I've been struggling for too long now. Probably my approach is completely wrong, and my knowledge of matrices are lacking. Scenario: Two parent meshes in a scene Each parent has one so called connector mesh as a child Both parents have a pivotMatrix which is not equal to Matrix.Identity() Both child connectors have a pivotMatrix which is not equal to Matrix.Identity() Problem Moving the second parent in such a way that both child connectors have the same global position. Unfortunately this does not come out okay, because the pivotMatrix is 'messing' things up. What have I tried The models are made using 3DS Max and then exported to .babylon. When I apply a ResetXForm within 3DS Max on the connectors it all works fine, and the models connect at the right position. Unfortunately I do not have the possibility to do this for all the models I have. I've tried using this piece of code (TypeScript): let subject: BABYLON.Mesh = <BABYLON.Mesh>con2.parent; let con1pos: BABYLON.Vector3 = con1.getAbsolutePosition(); let con2pos: BABYLON.Vector3 = con2.getAbsolutePosition(); let pos2: BABYLON.Vector3 = subject.getAbsolutePosition(); subject.setAbsolutePosition(pos2.add(con1pos.subtract(con2pos))); What I would really like is a way to make the pivotMatrix == Matrix.Identity() and have the mesh/geometry stay at the same position. Because before I can move these, I also need to rotate the subject, in such a way that con2 faces the exact opposite direction as con1. And I am pretty sure that the pivotMatrix is going to mess up that as well. Edit: I've created two playgrounds. http://www.babylonjs-playground.com/#1UMJXS#0 (3ds max export where the connectors have an altered pivot) http://www.babylonjs-playground.com/#1UMJXS#1 (3ds max export where the connectors are reset using resetXform) I was very convinced that I did get values using the getPivotMatrix() method, but checking today, I was horribly wrong. Apparently that data is not output by the babylon 3ds max exporter. Which gives me the feeling there is little I can do about it. Perhaps the exporter needs to be adjusted so that the adjusted pivot matrix gets exported as well
- 4 replies
-
- translation
- pivotmatrix
-
(and 1 more)
Tagged with: