If you have ever dragged a part around to place it in ROBLOX studio (which you probably have) then you should understand fairly well what I am talking about.
I am trying to make a game that requires an extremely advanced object placing system, that of a similar quality to ROBLOX studio's object dragging system.
The method I have used to place objects is simply using the modulus operator to act as a grid placing system like so:
local move_len = 1; --amount of studs to move by
local function place_obj(obj, mse_p)
obj.Position = Vector3.new(
mse_p.X - (mse_p.X % move_len),
mse_p.Y - (mse_p.Y % move_len),
mse_p.Z - (mse_p.Z % move_len)
);
end
However this method does not exactly have a similar quality to ROBLOX studio's object placing system due to the fact that many times depending on the camera angle, the object will often be a said number of studs above the baseplate (if it is being placed on top of the baseplate), and occasionally be a said number of studs above a previously placed object that it is being placed on top of; not to mention, sometimes if the camera is at a certain angle, the object being placed will "run" towards the camera, then be placed far away from the camera, only to continuously "run" towards the camera and be placed far away from the camera again, until the camera angle is changed.
I believe that this behavior is either due to an issue with ROBLOX's mouse.Hit property, or my code to place the object is weak.
Either way, is there a better method for an object placing system that is of a similar or the same quality as ROBLOX studio's?
Thanks

3 comments
To an extent, you are doing it wrong. Remember to round up or down.
Do you mean I should be using math.floor and math.ceil?
Use http://wiki.roblox.com/index.php?title=API:Class/Handles