Log in to vote

Gridded movement in MH2?

Asked by 10 days ago

How would I make gridded movement like in Miner's Haven? In the game, I can select an item from my inventory and the item will snap to the grid when I move the mouse over it but will not move outside of the grid.

What systems will I need to make and how will I go about using them

You would need to use player:GetMouse(), then round it to the grid stud, and figure out were that is on the board. REALTimothy0812 94 — 10d

1 answer

Log in to vote
Answered by
oreoollie 273 Moderation Voter
10 days ago

This can be achieved using the Hit property of the PlayerMouse instance which can be retrieved using the :GetMouse() method of the LocalPlayer. To grid the position, you will need to math.floor() the x, y and z of the Hit. Then just repeatedly CFrame a part to the floored hit. The below code will create a grid on the CFrame.

local m = game:GetService("Players").LocalPlayer:GetMouse()
local h = m.Hit
local gridCFrame =, h.y, h.z)

I hope my answer solved your problem! If it did please remember to mark it as correct! :)


Answer this question