CFrame furniture system

Hello.

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:

https://gyazo.com/5f1f92ef9ef03f62dca6825eeb11255b

1 Like

Use Mouse.Hit.Position to get the position component alone.

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.

Can you be more detailed about the problem and your current solution to the problem?

I assume you mean Model:SetPrimaryPartCFrame()? If it works, then why don’t you use it?
Although there are good reasons on why not to.

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

Tried that already, as I stated before.

Also this returns.
https://gyazo.com/481db8078dae9c137446a179a7ee3217

1 Like

You need to be clearer on your debugging process here, as I don’t know what happened when you “tried that already.”

Is it that …

… or is the problem that …

…?

Sorry - my mistake. But it also means you didn’t try the method already.
Try this:
Model:SetPrimaryPartCFrame(CFrame.new(Mouse.Hit.Position))

1 Like


https://gyazo.com/6af80913cb3b910f4db69cb35f757995 that worked, which is great, but now its submerged in the ground, without using cframe to raise it up is there a way to raise it up

Disregard I fixed that, I got the size of the part and then cframed it from that.

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.

Model:SetPrimaryPartCFrame(CFrame.new(Mouse.Hit.Position) + Vector3.new(0, Model:GetBoundingBox().Position.Y/2, 0))

I keep brain-fogging on the parentheses here…

By the way, with the bounding box function,
https://gyazo.com/78eb9adfe0136790f8a7020299aa501c

Disregard, my mistake, I fixed it now.

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:

Model:SetPrimaryPartCFrame(CFrame.new(Mouse.Hit.Position + Vector3.new(0, Model:GetBoundingBox().Position.Y/2, 0)))

For readers, it would be most helpful if you would detail how you fixed the issue.