Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Any way to tween a full 360 rotation?

Asked by 4 years ago

Because due to the way tween's trigonometry works it can at max do a 180 flip. And firing two tweens queued sounds like a stupid way performance wise.

I have a lot of objects that should perform this at my map and I don't want to use for loops nor angularVelocity because tween is a c++ solution and should act more performant

0
I actually use 3 tweens to make sure it rotates the right way. I just connect like this tween1.Completed:Connect(function() tween2:Play() end) and so on. I did not found any better way. sleazel 1287 — 4y
0
Would it be still more performant than loops? ItsNimbusCloud 66 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

I have also encountered this issue before (when trying to make things spin forever) and I've found 2 solutions:

  1. Orientation

Though most of us would use CFrame, I found that by simplify using Orientation will solve the issue by Orientation = Part.Orientation + Vector3.new(360,0,0).

  1. CFrame

CFrame is indeed an option but math.angles(math.rad(360),0,0) will not work (I personally am unsure why). To use CFrame in case you are orientating a Model, you can do: ["CFrame"] = Part.CFrame*CFrame.fromEulerAnglesXYZ(360,0,0) (I'm not too sure if it's spelt exactly like that)

Anyway, if you are looking for a full rotation these are your options. If you are using TweenService, some properties may break it or buffer it such as reverse.

Hope this helped, please do note that these are options and there are probably other ways to do so either using your previous methods or new ones. All of these options have been tested by me so I'd assume it works. If it doesn't work comment your code or edit your question and I can get back to you.

0
Euler would work good enough thanks! ItsNimbusCloud 66 — 4y
0
I believe the reason the math.angles does not work for the CFrame option is because I believe the tweens always look for the SHORTEST route to their end result within the allotted time. On top of this, math.rad(360) and math.rad(0) are technically the same in the eyes of a computer. 0 just means it stays in the same spot and 360 reads all the way around and ending in the same spot. XxTrueDemonxX 362 — 4y
0
@XxTrueDemonxX that is most likely a reason; but at the same time iir (if i recall) math.angles is in z,x,y order for better orientation management. This could also be an issue since others would be from xyz BlackOrange3343 2676 — 4y
Ad

Answer this question