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 » Scripters
Home Search
 

Re: Really odd CFrame movement issue...

Previous Thread :: Next Thread 
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
10 Nov 2017 03:11 PM
I am using a position Handles object to move blocks around.

I got a table of functions defining movement for different NormalIds, an example would be:

local movement = {
[Enum.NormalId.Front] = function(obj, delta)
obj.CFrame = obj.CFrame + (obj.CFrame.lookVector * delta);
end;
...
};

the movement table contains a function that defines movement for each NormalId.

Now on the handles MouseDrag event I calculate a delta, using a previously acquired drag distance, and the current drag distance. (dont worry, I reset the previously acquired drag dist in the handles.MouseUp event function)

move_handle.MouseDrag:connect(function(fase, dist)
if not debounce then
debounce = true;
local delta = (dist - (dist % 0.5)) - (last_dist - (last_dist % 0.5));
--I move blocks by 1/2 of a stud
for i,v in pairs(movement) do
if i == face then
movement[i](move_handle.Adornee, delta);
end
end
last_dist = dist;
debounce = false;
end
end);

The problem comes occasionally when I move a block, then let go of the handle, the block will move by 1/2 of a stud in a seemingly random direction. This often happens when I am trying to place a block right beside another block, however whenever a user decides to enter the position mode, I make sure every block in a user's workspace is CanCollide false so that you can move blocks inside of each other without problems.

I have no other code that changes the position of the block other than this movement code, so what could be causing this annoying and odd problem? Am I not doing something correctly, or am I forgetting to do something important? or is there something wrong with ROBLOX?

thanks
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
10 Nov 2017 03:51 PM
bummmmop
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
10 Nov 2017 05:41 PM
bumpo help
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
10 Nov 2017 06:58 PM
buuuummmmmmopooooo
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
10 Nov 2017 09:43 PM
bumpbumpbumpbumpbmupumpbmpuhrtedrfa
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 12:24 AM
bump help please
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 09:15 AM
bump bump help please
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 10:55 AM
BUMP HELP THIS IS A FRUSTRATING PROBLEM
Report Abuse
Elbixdio is not online. Elbixdio
Joined: 03 Aug 2016
Total Posts: 38
11 Nov 2017 11:29 AM
learn your scripting this is an easy fix


Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 04:33 PM
@Elb I'm obviously too stupid to see the problem in this case, which makes me sad.

I literally don't understand what is causing my problem.

if you want the code for the MouseButton1Up event here it is

move_handle.MouseButton1Up:connect(function()
last_dist = 0;
end);

please help :(
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 05:26 PM
bump
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 05:42 PM
nevermind im stupid, i somehow just realized how dumb I was for placing a debounce on the drag function lol!

Easiest fix ever,
thank you elb.
Report Abuse
Skylake_X is not online. Skylake_X
Joined: 16 Jul 2014
Total Posts: 275
11 Nov 2017 05:44 PM
dont use semicolons this isnt c
Report Abuse
Voxxie is online. Voxxie
Joined: 27 Aug 2006
Total Posts: 325
11 Nov 2017 05:46 PM
There's nothing wrong with using semicolons :^)
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 05:50 PM
nevermind the debounce has nothing to do with the problem as it still persists.

I like using semicolons to format my Lua code; are you trying to say that the semicolons are the cause of the problem?
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 07:14 PM
bump
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 08:27 PM
bump
Report Abuse
rareswagteam21 is online. rareswagteam21
Joined: 30 May 2015
Total Posts: 3
11 Nov 2017 09:26 PM
So Whats the problem here
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
11 Nov 2017 11:33 PM
bump
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
12 Nov 2017 11:38 AM
bump
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
12 Nov 2017 12:20 PM
I finally realized that the iteration in the MouseDrag function is pointless, so I removed it, however the problem is still there.

move_handle.MouseDrag:connect(function(fase, dist)
if not debounce then
debounce = true;
local delta = (dist - (dist % 0.5)) - (last_dist - (last_dist % 0.5));
--I move blocks by 1/2 of a stud
movement[face](move_handle.Adornee, delta);
last_dist = dist;
debounce = false;
end
end);
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
12 Nov 2017 01:24 PM
bump help
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
12 Nov 2017 02:07 PM
bump
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
12 Nov 2017 03:27 PM
bump

I think this thread is getting close to the world's most number of bumps without receiving any help.
Report Abuse
MICHEAL1988351 is online. MICHEAL1988351
Joined: 26 Jan 2015
Total Posts: 582
12 Nov 2017 04:28 PM
bump help please
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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