Jump to content

Setting mesh origin point for movement and scale


royibernthal
 Share

Recommended Posts

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).

origin point.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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?

Link to comment
Share on other sites

@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 :)

door_pivot1.png

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...