Dad72 Posted September 16, 2018 Share Posted September 16, 2018 @trevordev, Hello, I find a bug on the gizmos when we merge objects. If I am merging two objects and then replacing the pivot in the center of this new merge object. The gizmo is no longer on the pivot of this new objects but anywhere, corresponding to vector3(0,0,0). http://playground.babylonjs.com/#8GY6J8#160 On my project the pivot is totally shift to several units of the object (it depends on the meshes) See the picture : JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 17, 2018 Author Share Posted September 17, 2018 @Deltakosh, In fact it is not the gizmo that is misplaced, but setPivotPoint which is not updated when objects are merged. On this PG we can see that the gizmo is placed in the same place, whether I use setPivotPoint or not. The point of the center of the object is the good one, it is the small white sphere which serves as indication http://playground.babylonjs.com/#8GY6J8#161 Quote Link to comment Share on other sites More sharing options...
Guest Posted September 17, 2018 Share Posted September 17, 2018 Well the setPivotPoint works: http://playground.babylonjs.com/#8GY6J8#162 So I still think it is a gizmo bug...Pinging @trevordev tracker: https://github.com/BabylonJS/Babylon.js/issues/5161 Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 17, 2018 Share Posted September 17, 2018 Due to Babylons current implementation of pivot points not supporting any order manipulation operations, I would say using the pivot for this would not be supported. Would using a parent mesh as the pivot point work for your scenario? See this playground: http://playground.babylonjs.com/#8GY6J8#163 Dad72 and JackFalcon 1 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 17, 2018 Author Share Posted September 17, 2018 Yes it works like this. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 17, 2018 Author Share Posted September 17, 2018 @trevordev, No, it does not work completely. If I want to select the object later, the gizmo is not well placed, it comes back as before. Moreover, we have to select one of the two rabbits. the object is not considered as a single sectionable with pickResult.pickedMesh. The fact of creating a new BABYLON.Mesh makes me lose all give to serialize the merge object. http://playground.babylonjs.com/#8GY6J8#164 The pivot seems to place correctly on the merge object. Why the gizmo can not be placed on this pivot point? Looks like MergeMesh has a lot of different problems at home? problem of placement of the Gizmo, problem of material which disappears with multiple materials. I'm starting to wonder if I will not remove the merge from my software, because I can not do anything right. Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 17, 2018 Share Posted September 17, 2018 To get the gizmo in the right position again, maybe you could check if the selected mesh has a parent and use that if it exists to attach the gizmo. Can you provide more details about what you are trying to build? Are you looking for the ability to group any number of objects and move them around with gizmos or something else? How would you like the serialization to work? Quote Link to comment Share on other sites More sharing options...
Guest Posted September 17, 2018 Share Posted September 17, 2018 other solution: you can bake the transform: http://playground.babylonjs.com/#8GY6J8#165 (this way you are centering the new mesh on its origin) And this is not "problems" but how the merge works The MergeMesh takes data from both meshes and merge then. It is not responsible for centering the mesh or whatever trevordev and Dad72 2 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 17, 2018 Author Share Posted September 17, 2018 Your solution seems to work well Deltakosh. Thank you. ? Yes trevor I am trying to regroup several objects and to be able to move this new object merged. It's for a MMORPG editor: More detail here: trevordev 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 17, 2018 Author Share Posted September 17, 2018 I add the last two lines that allow to replace the object to merge to its original place and refreshing the BoundingInfo Speckle my object to disappear when I am too close to the object. I can solve, it works on my project. Thanks again let boundingInfo = meshMerged.getBoundingInfo().boundingBox; let middlePivot = new BABYLON.Vector3(boundingInfo.center.x, boundingInfo.center.y, boundingInfo.center.z); meshMerged.setPivotMatrix(BABYLON.Matrix.Translation(-boundingInfo.center.x, -boundingInfo.center.y, -boundingInfo.center.z), false); meshMerged.bakeCurrentTransformIntoVertices(); meshMerged.setPivotMatrix(BABYLON.Matrix.Identity()); meshMerged.position = middlePivot; meshMerged.refreshBoundingInfo(); Quote Link to comment Share on other sites More sharing options...
Guest Posted September 18, 2018 Share Posted September 18, 2018 My pleasure always! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.