// [SOLVED] //Grid Building System; Varying sizes of objects issues

Intro

Currently working on a custom Grid Building system; Running into issues when trying to use different sized models. The building system works fine when the hitbox of the models are 4x4x4, this makes sense as the system is on a grid of 4.

Goal

As I expand this system I want to have varying sizes of hitboxes for models such as doorways, windows, etc. etc. The hitboxes will still stay within multiples of 4’s (ex. 4x8x12), but regardless it’s causing issues for the system.

Context

A decent portion of the system is from tutorials, but I converted it to work with models as well as some bug fixes and other changes I’ve made to fit my needs. Henceforth I struggle with understanding the complex ish CFrame math going on here.

Issues

The direct main issues I’m facing are as follows.

Firstly the [GridAlignmentValidation] check (that ensures objects aren’t somehow places off grid), refuses to place when using hitboxes that are not 4x4x4.

Secondly if the above check is simply disabled for testing purposes, you will notice that if the hitbox is uneven in size (ex. 4x12x24) the object will not line up with the grid when rotated.

Lastly (and arguably most importantly) the object is rarely properly lined up with the cursor, often even multiple studs away and the object is almost always sunken into the ground.

Resources

Below I’ve provided links to all my code, a video demo of the system & issues, as well as the explorer hierarchy. If needed, I can provide the actual game place file upon request. Either contact me here, or on Discord: @/epoxtime

Video Demo:

https://www.youtube.com/watch?v=3j4IufiTNmY

Explorer Hierarchy:

Imgur

ClientPlacementHandler:

ServerPlacementHandler:

ObjectPlacementValidator:

Thanks! : )