I am moving objects using:
object.transform.position = newPosition;
The problem is that it’s using the object’s local pivot position and I need it to use the object’s center pivot position (like when switching the pivot mode to “Global”). How can I force the object’s position to be calculated using the center pivot?
Thanks for your time!
Stephane
Well, the centre pivot is something which the editor gives you based on (presumably) the bounding boxes of all the selected objects. You could try using renderer.bounds.center to find the middle, and then offset all of your movements by the difference between that and the original transform center.
Better still, you could instantiate an empty object using new GameObject(“name”);, then set its position to the bounding box centre, and then make it the transform parent of your first object!