How to move models along a grid with their primary part size higer than the grid size

  1. What do you want to achieve? Keep it simple and clear!

Sorry if the title is a bit confusing. I didnt know how to properly explain it…

But anyways i want my code to move models along a 4x4x4 grid even though their primary part size is higher than the grid.

  1. What is the issue? Include screenshots / videos if possible!

So like the code works perfectly when moving stuff that has a primary part size of 4x4x4. But i want my code to also be able to move models with their primary part higer than the grid along the grid…

So like an example. A bed. I want it to move along the grid but still snap to the grid if thats possible?

Rn i got a bed with its primary part size set to 4x4x4. It works i guess but when it moves to a new position the bed sometimes moves outside the grid… Heres a video to give you a better understanding: 2022 01 31 00 50 35 - YouTube

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Ive been looking in every corner of the internet it feels like but can never find any solution to this

So if someone could tell me how i could calculate the position based on the primary part size that would be truly awesome since ive been struggling with this for AGES

The easiest solution to me seems to be to just stick a perfectly-grid-sized part in every model and make that your primary part. Make it Transparency=1 and CanCollide=false.

That way you can determine how the model should be aligned as an artistic question rather than a programmatic one.

Otherwise you have to start figuring out all sorts of questions, like how exactly a model that doesn’t fit on the grid should be aligned to the grid. That seems like a question better left to the modelling phase.

1 Like

Sosomething like this??

Sure, yeah, assuming that part is a multiple of your grid size. Make it the bed’s PrimaryPart.

1 Like