Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How does roblox calculate mouse acceleration?

I'm currently making some changes to my Camera script, and someone mentioned that Roblox has Mouse Acceleration on and they didn't like it. Because I'm making my own version of the camera, I'd like to be able to add the option to disable this. But I can't work out how to get it to work :S Is there any good documentation on this?

So after eLunate's answer I've edited my script from changing all changes in Delta to 1, 0 or -1 by using the following:

			local MoveX = type.Delta.X
			local MoveY = type.Delta.Y
			if MouseAccel == false then
				print("Ay")
				MoveX = math.sqrt(type.Delta.X)
				MoveY = math.sqrt(type.Delta.Y)
				print(type.Delta, " Compared to: ",MoveX,"",MoveY)

However, I am recieving the following prints:

-7, -2, 0  Compared to:  -1.#IND  -1.#IND
Ay
-5, -1, 0  Compared to:  -1.#IND  -1.#IND
Ay
-6, -3, 0  Compared to:  -1.#IND  -1.#IND
Ay
-4, 0, 0  Compared to:  -1.#IND  0

Any suggestions?

3 comments

1

It's as a power of the difference in position.

0

So, when it says the delta is 36, its actually 6^2?

0

Can't sqrt negative numbers (Imaginary/indefinite result)

1 answer

✓ Accepted answer

You can't get the root of negative numbers
Think positive

In order to get the root of a negative number, you can probably try something like this:

local _sqrt = math.sqrt;
local sqrt = function(n)
  _n = _sqrt(math.abs(n));
  if n < 0 then
    return -_n
  end
  return _n
end

This discussion is preserved as it was. New answers, comments, and votes are closed.