Hi EgoMoose, it appears the script you posted for the placement system to be used on multiple parts fails to uploaded the saved furniture items. It appears you are missing the fire of the function Placement.fromSerialisation() for the items to load in.
Currently having this same problem and I’m super confused right now. Could you tell me how you got the client to check the collisions? I keep overthinking it and confusing myself.
Thank you for this!! I hope that as developers, we can improve more of the system.
Do you think you could go into more detail on how you got the furniture to only be movable on specific parts? Your reply that seems like it was explaining it is basically a giant wall of code, and on top of that it’s using an OOP approach which I personally find unreadable.
It would be helpful if you could show something that’s more reader-friendly and explains what they heck you’re doing. The cherry on top would be if it were more general. I like the grid-placement but I don’t want to use everything you’ve written here.
Not sure if you figured this out already, but here it is for future people looking at this thread.
The way he was able to make the furniture only move on a specific part(s) was due to the fact that he set the players mouse TargetFilter to the “canvasPart”. Next, he just set the models parent to the target filter.
Mouse = Player:GetMouse()
Mouse.TargetFilter = workspace.CanvasPart
The loading for the more advanced version where you can have multiple canvases does not work. What’s the point of saving the data if you won’t be able to load it. Unless I’m wrong and loading function works, but I honestly have no idea how to specify what exact canvas the model had been placed on and how it will load it ignoring the fact it can be placed on multiple canvases at once. I have tried making it possible but I was kind of met with failure. The saving itself is alright but the loading has a few issues.
Nice tutorial, I will 100% reference this when I will need to make something like this
One problem I ran into was that when I would save and rejoin, it would actually clone multiple of those models in the same position and the more times I would save and rejoin the more it would clone these models.
How can this be adapted so that the rotation of the object still faces the floor?
what if i want to place on smooth terrain how would i do that?
just use a invisible part as the canvas area
How do you convert Vector2 to Vector3? Also, how do you make objects stack?
Vector2 to Vector3
– I don’t know why you want to achieve this, but here is easy solution
Vector3.new(vec2.x, 0, vec2.y) or Vector3.new(vec2.x, vec2.y, 0)
Object stack
– I assume ‘stack’ that you mean is something like lamp place on the table.
In this example, just make placement canvas as desk surface or hidden canvas on desk surface.
– I assume that later question relate to first one, where extra axis of vector is current ‘height’ of object stack, I don’t recommend to store data that way, I prefer something like this:
"canvas": {
"item": Furniture:getId("desk"),
"position": Vector2.new(12, 24),
"rotation": 90,
--"__comment": "You can use something like this if you prefer, 'transform: Vector3.new(x, y, rotate)' ",
"canvas": {
--[[ 1:]]{
"item": Furniture:getId("lamp"),
"position": Vector2.new(0, 0),
"rotate": 0,
--"__comment": "canvas: {} --if you want item to place-able to your lamp! Side note, position should relate to it parent not main canvas or world"
}
}
}
Do you see that is better to store data object this way than array of vector of x,y,height and if player move table, lamp move too. If player remove table, lamp gone as well. No floating lamp anymore.
I wrote it in JSON format because it is compatibility with Database Datastore, and it also look like Lua table too.
– If you mean building floors, almost same to desk example :
"plot": {
--[[1: ]]{
"canvas": {DeskWithLampObj, chairObj}
},
--[[2: ]]{
"canvas": {}
}
}
If I am wrong with your question, feel free to notice me to correct it.
How can I make objects have them stack like a minecraft placement system?
It’s a metamethod, it’s used in Placement.new(). It lets you call the functions of the new placement.
Basically, all you need to know is every time you write a class, you use __index.
Ok which means:
local Placement = Placement.new(parameter1)
local something = Placement.__index --the parameter1 == __index???
No, like this:
Placement.__index = Placement -- placement is the default value
setmetatable({}, Placement) -- when it is used
Ok, but the __index canot be use then the metatable is not created?