Since GetModelCFRame() is deprecated due to the reason Sharksie gave, could we get a non-deprecated method for returning the center position (Vector3) of a model, as I use it for Region3 and range calculations for things like automatic doors and regen buttons.
What Sharksie said is wrong. GetModelCFrame should be undeprecated. GetModelCFrame returns the current center of the model – if your code breaks because you expect the center of an unanchored assortment of parts to remain in the same place, that sounds more like a lack of understanding of unanchored parts as opposed to GetModelCFrame not working correctly.
Sorry, edited my post as you were replying. I’m not really familiar with this method, so excuse my ignorance.
So GetModelCFrame() already does what you want, but is being deprecated?
Personally, when I need a physical property of a model such as the center for distance checks, I just put an invisible block in it to represent that physical property. It’s probably not ideal, but it works for my purposes…
I have no doubt of the uses, thanks. The problem is that I don’t know if GetModelCFrame really found you the center of the bounding box or the center of a computed PrimaryPart.
What do you mean? If you have n parts in the descendant tree of the model then it’s O(n) right? I think it’s just a matter of summing the positions of the middle of the parts multiplied by their respective weight, where the weight is determined by the magnitude of the size of the part. And then for the result you simply divide the resulting vector by the total sum of weights.
This would at least work fine for regular parts, wedges, spheres, etc, and for union parts you could simply assume that their center is the middle of the bounding box.
I don’t think the algorithm I describe is unstable. Or do you think it is too slow instead? I don’t think it should take that long to traverse the descendants tree of a model and sum up the position * size weight like that and then divide the total, and if we’re calling it on a model that is too large then surely that would be the developer’s problem.