Ad
Log in to vote
1

Gridded movement in MH2?

Asked by 2 months 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

0
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 — 2mo

1 answer

Log in to vote
0
Answered by
oreoollie 275 Moderation Voter
2 months 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 = CFrame.new(h.x, h.y, h.z)

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

Ad

Answer this question