I don't want to manually set a part in the middle as the primary part, so any ideas how to do the math or whatever I need to do?
Or how to find the nearest model to a Vector3, that's what I'm trying to do with this in the end
Thanks in advance!
I don't want to manually set a part in the middle as the primary part, so any ideas how to do the math or whatever I need to do?
Or how to find the nearest model to a Vector3, that's what I'm trying to do with this in the end
Thanks in advance!
Hmm, I guess you could add the positions of all the parts in the model and find the average. For instance, if you have 24 parts in a model, you would add all of the parts' positions and then divide them by 24. That should give a center, but maybe I am wrong, I do not know. Sorry I didn't give a script, it should be simple, probably lots of variables though if you have a lot of parts...
You could use a for loop instead of having to reference every single part
Yes, that would work better than referencing each part.
Yea I was just watching youtube and I thought "why am I so stupid I could average the positions" then I came here to delete the question
Wait no that wouldn't do what I want, if there's more parts to 1 side it's gonna be closer there...
At this point, I recommend just having an invisible center part as the PrimaryPart...
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Perhaps if you get a vector3 for the center of the model you could store that in a Vector3Value object and calculate the distance/magnitude between the two models by subtracting their Vector3 positions