|
| 27 Nov 2013 10:08 PM |
Hello, So I've been at this a few days and have been stumped. I'm trying to make a tycoon where you can place your own buildings, and while I can get models to move/rotate and not intersect, they don't snap to a grid.
I've tried using the dragger instance, but you can move models to any height you want (I want them to stick to the ground).
For an example, crazyman32 (somehow) did it in his RPT2 game: http://www.roblox.com/RPT2-place?id=130087575
Any help is appreciated! |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Nov 2013 11:10 PM |
In my RPT2 game, they are locked to a grid.
I use a special function I wrote to assign a model to a specific CFrame value, given a center part of the model to base the movement about.
Here's an example:
function SetModelCFrame(model, cframe) local center = model:GetModelCFrame():inverse() local function Scan(parent) for _,v in pairs(parent:GetChildren()) do if (v:IsA("BasePart")) then v.CFrame = (cframe * (center * v.CFrame)) end Scan(v) end end Scan(model) end
SetModelCFrame( game.Workspace.SOME_MODEL, CFrame.new(0, 10, 0) * CFrame.Angles(0, math.rad(45), 0) )
|
|
|
| Report Abuse |
|
|
|
| 27 Nov 2013 11:18 PM |
I really appreciate you responding, but I don't quite get it..
How would I use this to snap a model when moving it with the mouse? |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2013 11:38 AM |
| Still don't completely get it.. |
|
|
| Report Abuse |
|
|
|
| 28 Nov 2013 01:00 PM |
| Bump, all help is appreciated! |
|
|
| Report Abuse |
|
|
| |
|