(move is used abstractly due to the moves being physically based, aka player drags around chess pieces and if it ain’t legal, it resets to the move before the attempted move)
also im using workspace:getpartsinpart from a part extended a bit above the space to get the piece that moved, and using BodyPosition to have the engine’s pieces to move cooler and resetting the board coolerester
I… am really confused on what you are trying to do… Are you the developer of the github repository?
for the legality check, can’t you just have a dictionary relating each piece to their own move function?
why is your code… minified? Are you trying to transpile into luau? If so, why are you asking how a function is made instead of figuring out how to solve the edge case that broke your transpiler?
Body position is deprecated, for your use case, consider Tween
which part of any of this system are you having an difficulty in? Finding out which grid the dragged piece is in?
local function vec3ToGrid(chessPiecePos : Vector3)
chessPiecePos = math.round(chessPiecePos/gridSize)*gridSize
return Vector2.new(chessPiecePos.X,chessPiecePos.Z)
end
I’d also like to know what you need help with. Additionally, I have to comment that the source of truth in using GetPartsInPart to denote moves involves an implicit observation. If there are any physics bugs, this could be faulty? I think that you should store the moved piece in code as the player moves it.
the button also acts like a reset board button, since there’s no way in hell that knocked around pieces are legal (also i can just add exclusions to the pieces being destroyed in my destroypartfallheight implementation )
once you get the 8x8 array with the positions its exactly the same logic as any implementation
to make moves work with freeform physical movement i think you should take a snapshot of the board when the player says their turn is done, like when they hit the chess timer
just measuring the legality of moving from the previous snapshot to the current snapshot is sufficient, and you dont have to measure any game states in between during moving