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.
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!