So, basically, if you have played building games, in them, if you move to a wall that is curved or at the left of other walls, the block or the structure would turn. How would I do that? Any solutions? Thanks.
Not talking about this, it’s not with grid + it can’t be placed on any surface
Dude that is a good base. All you have to do from there is add a math.floor on the position calculating. Then just make it go its hit y + half the parts size y.
but anyway check this series out, it should help…
I don’t fully understand what your asking about. Maybe explain, and we could be able to help.
See, if you are placing a block at a wall, and you move your mouse to some other wall that is curved, the block will be placed on it
Hm, I’m still not fully understanding your question here. It seems like you would just need a basic placement system as listed in another reply by someone else. Then you would need to find the angle of the wall (if its a curved wall) and make the blocks rotation the same as the angle the wall is curved at.
first check these guys out
you’ll notice the raycast result returns a normal.
this could easily be used to place objects relevant to other surfaces, right?
--this crate is a 4x4x4 cube
local crate = workspace.Crate
local crateSize = 4
crate.CFrame = hitPart.CFrame + normal * crateSize
you could definitely fine tune this to make it more advanced, but this small bit of code should easily work for a basic placement system. (like minecrafts placement system)
Sorry, what is the normal variable?
well from my understanding. (someone please correct me if im wrong), if you hit the Right sided surface, then the normal would be Vector3.new(1,0,0) (one stud to the right of the hitPart)
so Vector3.new(1,0,0) * 4 = Vector3.new(4,0,0) which is a perfect offset from the part that you hit.
you can basically say this is a unit vector used for directions, just like LookVector, RightVector, and UpVector (and their negative counterparts) are used for.
this would only work for symmetrical objects though, if you have complex shapes then you’ll need more custom methods for each object.