qqdarren Posted June 5, 2015 Share Posted June 5, 2015 Not sure if this is a Babylon or Blender question. I've made a single mesh (an extruded letter) in Blender, exported it, and imported it into my BabylonJS script. I then have an ArcRotateCamera which rotates round it. by setting `camera.target` to be the imported mesh. Q = newMeshes[0]; Q.position = new BABYLON.Vector3(5, -9, -15); camera.target = Q; camera.radius = 1.2; It works, but the camera is sometimes further away from the letter, sometimes crashing through it. I.e. the reference point it is rotating around is the bottom-left of the glyph mesh. In Blender I'd positioned the bottom left of the mesh at the origin. So I moved it, so that the centre of the mesh is at the origin, and exported again. But that made no difference at all. I think all I've done is move the position of the mesh in the blender scene, whereas I want to alter the internal reference point of just the mesh? --------------------------------------------BTW, I found this http://www.html5gamedevs.com/topic/10118-set-origin-or-pivot-of-mesh/ But when I tried that: var matrix = new BABYLON.Matrix.TranslationToRef(0.23, 0, 0.15, Q.getPivotMatrix()); Q.setPivotMatrix(matrix); I get an error from inside the Babylon.js file itself: TypeError: this._pivotMatrix.multiplyToRef is not a function ...s.position.z,this._localTranslation);if(this._pivotMatrix.multiplyToRef(this._lo... (But, anyway, I really want to fix the model, not have to hack solutions over in the JavaScript.) Quote Link to comment Share on other sites More sharing options...
qqdarren Posted June 5, 2015 Author Share Posted June 5, 2015 This fixed the setPivotMatrix() problem: var matrix = BABYLON.Matrix.Translation(-0.46, 0, -0.30); Q.setPivotMatrix(matrix); The magic numbers there came from the babylon file: "position":[-0.4571,0,-0.295] Quote Link to comment Share on other sites More sharing options...
gryff Posted June 5, 2015 Share Posted June 5, 2015 So I moved it, so that the centre of the mesh is at the origin, How did you move it qq? Just dragged it ? Or Object->Transform->Geometry to Origin? cheers, gryff qqdarren 1 Quote Link to comment Share on other sites More sharing options...
qqdarren Posted June 5, 2015 Author Share Posted June 5, 2015 Aha, I'd just dragged it. My first attempt, just now, to use "Object->Transform->Geometry to Origin" did nothing, as I did it on the curve, then converted to a mesh. My second attempt did work, yay! So the process is: Make text & extrude it Object -> Convert to mesh Object->Transform->Geometry to Origin File > Export to babylon format Thanks :-) 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.