Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Any alternatives to CFrame? Furniture clipping through floor.

Asked by 2 years ago

So, I am working on a sinking ship game and one of its features is having the furniture slide around when at a certain angle. Although, I have ran into a problem where the furniture will clip through the ground and It is really annoying. I am currently using CFrame and I know CFrame isn't the best for stuff like what I am explaining. I haven't got any errors, I'm simply looking for a resolution and suggestion to this problem as I want to make sure I am able to implement this feature as it will really add detail into the game.

0
You can use Vector3 but CFrame would be your best option. You can use other stuff like GetTouchingParts for any clipping greatneil80 2647 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago

Hi I have a solution to your question!

So 1st you want to put all your furniture into a folder so you have them all in 1 place!

Then you probably want to an-anchor all the furniture once the ship is tilting so they slide off on their own.

You also want a set position of when to un-anchor the furniture

heres an example code:

local furfold = game.Workspace.Folder
local ship = game.Workspace.ship
local furchild = furfold:GetChildren()
local furnum = #furchild

if ship.Orientation == vector3.new(0,0,90) -- say the furniture will slide if the ship is tilted 90 degrees on the z axis.
    for i = 1, furnum do
        local furniture = furchild[i]
        furniture.Anchored = false
    end
end

Hope this helped!

Any questions? Just ask!

0
Thanks, this helped a lot. iiMxtt_Destinyii 62 — 2y
0
Sorry for such a late reply. iiMxtt_Destinyii 62 — 2y
0
No problem, glad it helped! :))) sne_123456 439 — 2y
Ad

Answer this question