Recently I started on a furniture system but the problem is, I am using mouse.hit to determine where the funitures primary part will land, the cframe of the mouse is tilted with the camera aswell, is there something I can do to fix this and make it flat? an example of what I mean is below:
I tried that and it glitches out, you see there is more than one part to the model I am placing, therefore moving the primary part doesnt move the rest of the parts with it, although primarypartcframe does.
I am using Model:SetPrimaryPartCFrame() and setting the cframe to my mouses cframe, the problem is the mouse tilts upwards when looking around with the camera which is making it go wonky. is there a way to flatten it out. An example is in the gyazo link I provided.
Are you confused about the difference between a CFrame value and a Vector3 (Position) value? You can still use SetPrimaryPartCFrame with just a position value*:
Model:SetPrimaryPartCFrame(Mouse.Hit.Position)
*Correction: a CFrame value containing just a Vector3 value
Although it isn’t a universal solution if you, say, wanted to place furniture on the wall; a quick solution would be to just add half of the model’s height to the Vector3 value used in SetPrimaryPartCFrame. Getting the size of the model requires using the model’s GetBoundingBox function.
To be honest here, this is close to unexplored territory for me. I think I’ve only dealt with a similar situation (placing models correctly) twice before, and even then it was fairly bare-bones. After this post though I’m going to sleep, so good luck!
Try putting the Vector3 additions inside the CFrame.new constructor, like so: