Jump to content
grofit

Moving pivot points?

Recommended Posts

Hey,

 

Is it possible to move the pivot point of an object. I have a situation where a user can change the equipped items and I need the pivot points to basically be in the connection point not the center of the object.

 

I think MXD has this functionality so I assume there is something similar in probuilder, however I cannot for the life of me find it, I can set pivot point but I think that just resets it to the center.

 

So is there a way to just move it freely on the object?

Share this post


Link to post
Share on other sites

Using the Set Pivot command (Ctrl-J) will set the pivot of the object to the center of whatever your current selection is.  So if  you have the vertex tool enabled and select a single vertex and hit Set Pivot, that will be the new pivot point.

Share this post


Link to post
Share on other sites

Doesn't seem to work for me, if I press Ctrl+J (or use the Set Pivot toolbar option) on a face or vert then go back to top selection mode, the pivot point is back in the center of the overall object.

Share this post


Link to post
Share on other sites

AH! no, thank you very much!

 

It would still be good if there was some way to freely move around the pivot point, especially with ProGrids. I found this functionality very useful when I was using MXD.

 

I have just gone through but it seems to randomly reset the pivot points, for example I was just setting a gun turret placement, and it was in the right place, I went and did 2 other components and re-loaded and then it seemed to have reset the other pivot position. So if I go and change anything else it just seems to keep resetting the others, I am not sure if it is because of the grid snipping as it seems to move the objects when the pivot point changes, but I dont want to have to disable snipping just to keep custom pivot points.

Share this post


Link to post
Share on other sites

Hi grofit- sorry this fell under the radar momentarily. Can you give us a step-by-step for us to replicate the pivot point changing? Thanks! I didn't quite understand what you were describing. Once set, the Pivot should definitely not move.

 

Being able to visually move the pivot would be handy, agree. Adding that to the "Wish List", though we are busy on the UV Update for now. Will try to get that in afterward though.

Share this post


Link to post
Share on other sites

Hi,

How can we use the pb.CenterPivot(...) in scripting  ? Apparently it is a Vector3 but needs to be filled with indices. I guess these are pb.sharedIndices ? How can I use that ? 

Share this post


Link to post
Share on other sites

There are a couple overloads for that function, here's one that just takes a Vector3:

 

	/**
	 * Move the object pivot to @worldPosition.
	 */
	public static void CenterPivot(this pb_Object pb, Vector3 worldPosition)

 

Share this post


Link to post
Share on other sites

But where is the center of the mesh itself ? When I select my pbObject and click on CenterPivot, it works fine : it moves the pivot at the center of the pbObject. In other words, how can I find the world position of the center of gravity of the pbObject ? Sorry to insist, I really tried to find the solution, but I still havent succeeded it yet...

Share this post


Link to post
Share on other sites

Oh, if you just want to put the pivot point in the center of the mesh you could take the center of the mesh bounds.

pb_Object pb = GetComponent<pb_Object>();

pb.CenterPivot( GetComponent<MeshRenderer>().bounds.center );

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×