How do I position a model without using SetPrimaryPartCFrame() or Pivot()

So I’m making a bloxburg type building system where it saves the vector3 position of each item model and the vector3 position of the brick where you can place the items, I’m using a system that gets the size between the plot brick and the item itself to position it relative to where ever the plot gets moved to, My problem Is that when I got to position the model it spawns it slightly to the side, So I’m looking to see if there’s a better way to position models WITHOUT using :MoveTo(),Pivot(),and SetPrimaryPartCFrame(), cause these all have the same effect.

1 Like

the only way to teleport a model is with PivotTo()
but every model has a PrimaryPart and this part is where the PivotTo() will move everything based off

if a model has no PrimaryPart, the moving location will just be the center of the model. and everything will just have an offset from that center and move together as one applying their offset from the center

its the same with a PrimaryPart, but this time you have control where that pivot point is (the center of the PrimaryPart) so you know exactly where the model is going to be positioned. so use this to your advantage to move stuff around

SetPrimaryPartCFrame is deprecated, dont use it PivotTo is so much better

I just tried that and It still didn’t work im not sure why Its doing this.
It looks like Its rounding the positions up or something
Green part CFrame(-26.054, 0.5, 1.6) Red part(Im trying to make it match the CFrame of the green part) (-26, 1, 2)

what i usually do is duplicate the entire model and position it to the right location. once its in the correct spot, i delete everything visual and just keep the PrimaryPart, make it invisible, and not move or change it at all

after that i use all those invisible duplicate PrimaryParts to figure out the position

for example: for a grid system, there would be one at every cell, then for that cell i find the correct duplicate PrimaryPart and use its cframe as the PivotTo() cframe

I just narrowed It down, It definitely has something to do with the green part position not being rounded up, how ever I want to be able to size that part with decimals, any thoughts on how to prevent CFrame from rounding the X,Y,Z cords?

Your problem is not with PivotTo or SetPrimaryPartCFrame, nor CFrame or Vector3 in general. All of these store coordinates as floating-point numbers and nothing rounds any values internally. The rounding is happening somewhere in your code. It seems like you want to snap a part to a grid location, but then with a non-integer offset from the grid location. Possibly this offset just isn’t being saved as expected?

Are you also making sure that if your parts are grouped in a Model that the Model.PrimaryPart is explicitly set? If you don’t set primary part, Models have some default behavior for when you get their Pivot or use the deprecated Model CFrame getters, where they just use the bounding box center IIRC.

You definitely want to find the real cause of the problem, because PivotTo is absolutely how you should be moving models, it makes sure all the parts stay positioned relatively without introducing and accumulating floating-point errors. You do NOT want to move all the Parts in a loop, performance and results of that would both be terrible.