If I were to create a spinning part, which would be better for performance?
- infinitely looping tween
- angular velocity (& bodypos to “anchor”)
If I were to create a spinning part, which would be better for performance?
I would use angular velocity since its smoother on both the server and client, un-like tweening, which is smoother on the client exclusively, but depending on what your trying to make.
Also infinitely looping tweens can break some times if an already playing tween hasn’t finished yet.
I also think Angular Velocity can be better for performance.
Basically, I would try Angular Velocity.
Alternatively, you can also try using Linear Interpolation.
You’re just saying things. None of this is actually correct. There is no point in using angular velocity if all you’re doing is spinning constantly. It is not more performant, as you’re doing extra physics calculations.
That’s what tweening is.
Tweening indefinitely would be the best option, assuming the object rotates the entire time.
“The more you know…”
strugglewiththe30chars
You can’t stop a tween while its playing, if your using lerping, you can manipulate it mid movement, that’s why camera systems use lerping instead of tweening.
Do you mean something different when you say you can’t cancel a tween? Because Tween:Cancel() and Tween:Pause() exist.
Just realised that exists, but would you rather have a ton of short tweens than a flexible animation?
The method you use to create an infinitely spinning part may depend on why you’re looking to achieve this effect.
If its for something purely aesthetic a Tween might be best. If you need physics calculations to be made for parts that collide with the spinning part, AngularVelocity might be the way to go.
If you do choose to go the tween route, I would recommend creating and playing the Tween on the client to avoid replicating the changes from the server to each client, however the performance impact and network traffic would be minimal if you’re only doing this for a few objects.
One more comment on the tweening approach:
If you’re looking to make an infinitely looping tween, use -1 for the TweenInfo’s RepeatCount parameter instead of calling Tween:Play()
in a while loop.
No.
First of all, you can pause a tween. It doesn’t look like OP wants to pause a tween so this isn’t relevant.
Secondly, camera systems use lerping because camera transforms are dynamic. Spinning a part is not. Tweening uses lerping, but lerping is not tweening. There are different uses for different things.
Probably binding to RenderStep and CFraming with alpha step. because then you’re not getting as much collision checks when you CFrame, with angular velocity the part needs to do physics step and therefore, collision checks. If the part does not need to be collidable, you could do even better and turn off CanQuery. Tweening usually isn’t used in loops.