could you please show me your script so i can see what went wrong? thank you :3
Wow finally an open source for grid related stuff, This is going to be useful for the current game Iām working on. Thanks for your contribution!
Is it possible to make a gui version of this? Im trying to make self learning chess
I find that the orientation not being relative to its surface grid, is it supposed to do that?
Or did i do something wrong?
local LibreGrid = require(script.LibreGrid)
local Setup = {
RaycastParams = nil,
ForceAlignedOutput = false,
AllowFaceAlignment = true,
NormalBased = false,
WhitelistedNormals = nil,
RoundingMethod = math.floor,
}
while wait() do
local block = workspace.Folder.Test
local Result = LibreGrid:GetCFrameAtMousePosition(
block,
1,
CFrame.new(block:GetPivot():ToOrientation()),
Setup
)
workspace.Folder.Test:PivotTo(Result)
end
Itād be helpful if you could provide us information of setting up and possible coding examples and what they do.
Take your time, this could be a game changer.
this module is focused on 3d, im sorry but i havenāt delved into the math needed to do this in a 2d space!
i can see why this happens. libregrid is rounding the position to the grid. however, the slope would require the block to get a bit off the grid to snap to that surface.
im not sure if i want to keep this behavior or allow parts to stay a bit off to snap to the surface. though, the current behavior facilitates sanity-checking on the server.
also sorry for the delayed response i didnāt see ur post
local function generateblock(usepos, target, isez)
local block = game.ReplicatedStorage.Files.BlockTypes:FindFirstChild(script.Parent.Properties.Shape.Value):Clone()
block.Size = script.Parent.Properties.Size.Value
block.Anchored = true
block.CanCollide = false
block.Color = script.Parent.Properties.Color.Value
block.Material = Enum.Material[script.Parent.Properties.Material.Value]
block.Transparency = script.Parent.Properties.Transparency.Value
block.Reflectance = script.Parent.Properties.Reflectance.Value
block.Name = "PreviewBlock"
block.Orientation = script.Parent.Properties.Orientation.Value
highlight.Parent = block
highlight.Adornee = block
if isez ~= nil and isez == true then
highlight.Color3 = Color3.new(0.337255, 0.796078, 0.0352941)
else
highlight.Color3 = Color3.new(0.00784314, 0.513725, 0.827451)
end
if script.Parent.Properties.Light.Brightness.Value ~= 0 and script.Parent.Properties.Light.Radius.Value ~= 0 then
local light = Instance.new("PointLight")
light.Parent = block
light.Color = script.Parent.Properties.Light.Color.Value
light.Range = script.Parent.Properties.Light.Radius.Value
light.Brightness = script.Parent.Properties.Light.Brightness.Value
end
if usepos == true then
local raycastparams = RaycastParams.new()
raycastparams.FilterDescendantsInstances = {block, game.Players.LocalPlayer.Character}
raycastparams.FilterType = Enum.RaycastFilterType.Exclude
block.Position = require(script.Parent.LibreGrid):GetCFrameAtMousePosition(block, 4, CFrame.fromOrientation(
block.Orientation.X, block.Orientation.Y, block.Orientation.Z), {
RaycastParams = raycastparams,
ForceAlignedOutput = false,
AllowFaceAlignment = true,
NormalBased = false,
WhitelistedNormals = nil,
RoundingMethod = math.floor
}).Position
--print(block.Position)
end
return block
end
i know this is taking forever
have you tried using the NormalBased
configuration? it allows you to align blocks to each surface better, just like your use case.
sorry again for the late response, i barely have any time rn
After setting it to true,
it still offsets on the X and Z axis
could you please check if the ground is offset from the grid? that might be why itās not aligned
I really hoped that LibreGrid would be more based on Relative grid/ voxel as well as working on grid relative to the main partās orientation. Sadly, this isnāt.
If you happen to be developing a new one please do mention and Iād be happy to know. Although, thanks for the contribution to the community. With libreGrid itās more suitable for game like Wubby and its inspiration.
while yes, it is offset from the grid, it brings back all the issues that came back when i was using math.round