Problems with a slow flawless spin

  1. What do you want to achieve? A slowly spinning object without errors
  2. What is the issue? Spin errors on the cross-over from positive to negative
  3. What solutions have you tried so far? I’ve made a spin every way I can think of
    Same error is in each version or technique. This is just a script that can show you the error.

Is it possible to just spin an object flawlessly? I’m starting to question if it is …

local Break = false -- flag
local P, Y -- pause, vector
local v1 = Vector3.new(0, 0, 0)
local part = Instance.new("Part")
part.Name = "SpinTest"
part.Locked = true
part.Anchored = true
part.Position = Vector3.new(0,0,0)
part.Size = Vector3.new(10,10,10)
part.Material = Enum.Material.Brick
part.Shape = Enum.PartType.Ball
part.Parent = workspace
task.wait(2) -- pause
--
function Spin()
	while true do task.wait(P)
		v1 += Vector3.new(0, Y, 0)
		--
		if string.match(tostring(v1.Y),"e") then print("error") end 
		--
		part.Orientation = v1
		print(v1) -- each step
		--
		if Break == true then break end
	end
end
--
P, Y = 1, 0 -- start the loop
task.spawn(function() Spin() end)
------------> TEST <------------
P, Y = 0.01, 0.01  -- clockwise
task.wait(2) print("reverse")
P, Y = 0.01, -0.01 -- counter
-- let run till past (0,0,0)
task.wait(2) -- pause for a bit
Break = true -- break the loop
-- check the print out ...

Script should be good to go, just pop it in the editor and give it a test.
Is there something I can do to fix this or is there a different type of spin technique.
(also: creating a hinged part will not work for how this is being used in the real program)

The reason this is a problem is you can clearly see a jitter due to this on the crossover. It don’t matter if you change direction or its just a simple one way spin. On the crossover it will jitter a bit.

This test is set up to get to the crossover quickly. So you can see the error without going all the way around.

Have you tried using this method?

game:GetService("RunService").Heartbeat:Connect(function()
	script.Parent.CFrame *= CFrame.Angles(0, math.rad(1), 0)
end)

“I’ve made a spin every way I can think of. Same error is in each version or technique.”

When it spins to the part it chages from a positive to a negative … I think there is a editor error.
(try the test and look at the print out … you’ll get a “e” value that makes a spin jitter)

So, what you’re trying to make is have the ball rotate from positive and then to the negative, like going front and then back?

I’m just looking to get a slow flawless spin … In my program, yes I will need to change directions.
It’s the slow part that seems to be getting me here. I’ve done it the way you stated … however I’m retesting that now. Looks like I tried .fromEulerAnglesXYZ and not rad() …

In your example, why you consider the scientific notation as error?

  0, 0.020000014454126358, 0
  0, 0.010000014677643776, 0
  error
  0, 1.4901161193847656e-08, 0 -- Why error?
  0, -0.009999984875321388, 0
  0, -0.01999998465180397, 0

As I understand from your example, you want to get those values consistently, and you are considering the e- as an error, while that number expressed its 0.000000014901161193847656

Which is not exactly incorrect in the sequence:

  0, 0.020000014454126358, 0
  0, 0.010000014677643776, 0
  error
  0, 0.0000000149011611938, 0 -- The error?
  0, -0.009999984875321388, 0
  0, -0.01999998465180397, 0

Because that’s the spot that makes the rotation jitter. I’m not calling the notation an error. I’m saying that is my error point. The jitter …

So close but yet again you get a jitter when the rotaion reaches 0,0,0 as it moves forward.
Looking back on my notes, turns out I did try that technique on the 2nd attempt.

This was my 3rd attempt … sB.CFrame = sB.CFrame * CFrame.fromEulerAnglesXYZ(0, srB, 0)
This one jitters the less. But I can still see it.

Idk, but, honestly I see the sequence numbers very constant without “jumps”
Decreasing around 0.009999997913837433 each iteration, and visually I cant see the jitter, but maybe Im not paying enough attention.

0.050000011920928955
0.04000001400709152
0.03000001423060894
0.020000014454126358
0.010000014677643776
0.000000014901161193 -- The "error"
-0.009999984875321388
-0.01999998465180397
-0.029999984428286552

I think so too … and even tried to go with a (0,0,0) switch at that point … It still jitters.
Try a few tests … The object I’m rotating is much larger and the jitter really sticks out.
I have a flawless rotaion right up till that point and after. In fact if you’re not looking right at it at that moment you will miss the jitter.

Around second 8 right? Yup, I see a very small “jump”, you are right

That video is terrible and makes it look junky … It’s actually a beauty and you get lost in the depth. Right up till the jitter >< … that Video looks like it’s all a constant jitter and very low res (from the editor). Probably would have never even noticed this if it wasn’t for how large this all is. You’re actually inside of it.

1 Like

The video its acceptable, and works to see what u meant about the jittering

Anyone understand how to do a rotaion with lerp? This may be my only hope.
I need more ways to rotate to test out here. Running out of attempts.

I was wrong, it is possible to get a perfect slow flawless rotaion … but, you need to use a local script.
It was a millisecond of random lag the whole time …

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.