royibernthal Posted October 31, 2016 Share Posted October 31, 2016 Before I start, I'd like to mention that I did a forum search, all the topics related to origin point were discussing rotation. If any of the existing topics apply to what I'm trying to do, please let me know. With that said - I'd like to be able to set the origin point of a mesh, so that when moved or scaled, it'll be according to that origin point. e.g. at the moment it seems the origin point is (0,0,0), I'd like to set it to (0.5,0.5,0.5) - assuming numbers range from 0-1 and represent 0%-100%. I attached a sketch to illustrate the issue, the blue circle represents the origin point of the box. At the moment when I scale a mesh, the result is (1), I'd like to achieve (2). Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 31, 2016 Share Posted October 31, 2016 Hello let's take a box (by default center is at 0.5 0.5 0.5): http://www.babylonjs-playground.com/#1ZK5I9#0 Now just use the pivot matrix to move the pivot to one corner: http://www.babylonjs-playground.com/#1ZK5I9#1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted October 31, 2016 Author Share Posted October 31, 2016 Hey True, when I test it on a simple mesh created directly in bjs the center seems to be at 0.5,0.5,0.5 by default as you say. It seems however that whenever I'm using models I'm exporting from blender it is not the case. I suppose it is defined somewhere in the exported .babylon file, however I'm not sure where to look or even what I'm looking for. What do you think? I created a PG, illustrating that when scaling the model it sticks to the bottom instead of to the center: http://www.babylonjs-playground.com/#1SVN3I#16 .babylon file: http://runeslots.com/misc/croc/croc.babylon .blend file: croc.blend Also pinging @gryff, he might have an idea what's going on. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted November 1, 2016 Author Share Posted November 1, 2016 @JCPalmer Quote Link to comment Share on other sites More sharing options...
adam Posted November 1, 2016 Share Posted November 1, 2016 If I understand you correctly, I'd simply change the origin in Blender so that it is in the middle and not on the floor. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 2, 2016 Share Posted November 2, 2016 Select mesh, right click. Shift-Crtl-Alt-C to bring up set origin , then pick 'Origin to Center of Mass' Dude, you need to learn what google is for your generic Blender questions. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted November 4, 2016 Author Share Posted November 4, 2016 @JCPalmer I did as you suggested, meshes are still scaled the same way on babylon as if the origin point was not changed. PG: http://www.babylonjs-playground.com/#1SVN3I#18 .babylon: http://runeslots.com/misc/bulbasaur/bulbasaur.babylon .blend: bulbasaur.blend @adam Did you mean what JCPalmer suggested or something else? JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
adam Posted November 4, 2016 Share Posted November 4, 2016 Yes. Did you apply the location before exporting your mesh? Quote Link to comment Share on other sites More sharing options...
royibernthal Posted November 4, 2016 Author Share Posted November 4, 2016 If I apply the location it seems it to send the origin point back to the bottom of the mesh on blender, and the exported .babylon seems to act the same on bjs. The PG link now has a mesh exported after applying location, acts the same: http://www.babylonjs-playground.com/#1SVN3I#18 JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
adam Posted November 4, 2016 Share Posted November 4, 2016 Try this: In Blender, drag your mesh so that it is where you want the origin to be (so that the origin is in the center). Now, apply the location. Quote Link to comment Share on other sites More sharing options...
rainerpl Posted November 4, 2016 Share Posted November 4, 2016 I dont know this for sure, but i use blender's 0.0.0 coordinate in edit mode as mesh origin. Drag the mesh in edit mode so that the 0.0.0 is where you want the origin to be. Quote Link to comment Share on other sites More sharing options...
adam Posted November 4, 2016 Share Posted November 4, 2016 That is what apply position does, but you don't go to edit mode. Quote Link to comment Share on other sites More sharing options...
gryff Posted November 6, 2016 Share Posted November 6, 2016 @royibernthal Well the title of this thread includes "movement", so here is how set up Objects in Blender so that I can animate them. The example I use here is a desk cupboard door (see image below) Step A: I have all my desk mesh objects in place in my Blender 3D window and I want to set a "hinge" position for a cupboard door so it can be animated. I am in "Edit Mode" with two vertices selected - the hinge edge. Note the origin of the door mesh is at 0,0,0 - inside the red-white cursor circle. Step B: I move the cursor to the centre of the edge defined by the two selected vertices with : Mesh -> Snap ->Cursor To Selected. The cursor is now where I want the hinge to be but the origin is still at 0,0,0 Step C: Now I go back into "Object Mode" and with the door still selected : Object ->Transform ->Origin To 3D cursor. I can now create a door open/close animation. You can select just one vertex or four vertices for one face or a group of vertices - experiment. I always keep the cursor at 0,0,0 - so Shift +C . And here is the final animated desk - click on the doors and drawers. cheers, gryff JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted November 9, 2016 Author Share Posted November 9, 2016 Sorry for the late reply. @gryff Hmm.. Are you sure it's relevant? Maybe i'm not understanding something. When you import this into bjs, is it scaled, rotated and position around the origin point you set? Regardless, I appreciate the detailed reply. @adam It indeed sets the origin to the middle of the mesh in blender (assuming I position the mesh that way beforehand). If for instance I now move the mesh to some random position, e.g. (100, 100, 100), would the only thing that matter in bjs be the mesh's origin (if at all) or would the mesh's position in blender also matter? If I simply place the mesh's center at the (0,0,0) of the blender stage, without applying the location, it acts in bjs as if the origin point is the center of the mesh. This got me wondering about the relevance/functionality of the mesh's origin point in blender when exporting to bjs. 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.