generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Moving/Rotating Models on grid without intersecting others?

Previous Thread :: Next Thread 
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
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
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
27 Nov 2013 11:06 PM
Bring
Up
My
Post
Report Abuse
crazyman32 is online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
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
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
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
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
28 Nov 2013 11:38 AM
Still don't completely get it..
Report Abuse
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
28 Nov 2013 01:00 PM
Bump, all help is appreciated!
Report Abuse
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
28 Nov 2013 02:43 PM
Bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image