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

Any suggestions for smooth, no lag rotation?

Asked by 8 years ago

I am trying to rotate a medium size model with about 36 parts constantly. I have it on a while loop that will rotate it a distance compared to itself using CFrame.Angle on a primary part. This works fine in studio but is really jittery in a server. I have hear about using lerp or slerp for rotation but I don't quite understand how to use it. Could someone explain what lerp/slerp is or give an example of a smoother rotation method?

while true do
    wait()
    x:SetPrimaryPartCFrame(script.Parent.CFrame*CFrame.Angles(0,0.005,0))
end

3 answers

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

There's no way to smoothly rotate something on the server. Latency will always make it appear jittery, because the position updates will happen between frames, and not always at the same rate.

The only way to get a smooth rotation is to use RenderStepped in some fashion on the client, which you've already stated is not possible, but I would like to ask why?

What, exactly, do you need this rotating bit of blocks for, for everyone to see?

0
Yes, I guess I could posibly copy the model and make them local parts and have the client rotate them. It's a giant rotating sign of the games name in parts, It's also used for some camera movement when the player enters the game so they can get a full view of the map. BobserLuck 367 — 8y
Ad
Log in to vote
1
Answered by
rexbit 707 Moderation Voter
8 years ago

Or You could use the RenderStepped event, it basically Fires each render frame in approximately 1/60 of a second.


game:GetService("RunService").RenderStepped:connect(function()
    x:SetPrimaryPartCFrame(script.Parent.CFrame*CFrame.Angles(0,0.005,0))
end)

0
Hmmm... ok, I'll give that a try and get back to you. BobserLuck 367 — 8y
0
Sorry, close but no cigar. It works fine in studio but it only works with local scripts. I am using a server script and can't use local scripts because I have filtering enabled. BobserLuck 367 — 8y
0
Sorry this couldn't work out. rexbit 707 — 8y
0
That's fine, thanks for trying though. I'm going to check out the Roblox forums and see what they say about it. BobserLuck 367 — 8y
View all comments (2 more)
0
You could use RemoteEvents/Function to connect your local script with the server script. BTW I'm back after like 2 months. EzraNehemiah_TF2 3552 — 8y
0
Why would I use a client for a wait on a server? BobserLuck 367 — 8y
Log in to vote
0
Answered by 8 years ago

Try using Angular velocity and body position. If the model only applies to one character (like a vehicle that only one player drives at a time), try setting the network owner of that model to the player driving. This way, only people watching you drive see the lag.

0
Unfortunatly, it's a rotating model in the server that all people will have to see rotating smoothly with no lag. In order to do this I'm going to have to make them local parts or something. But, how do I force a object to a client or server? BobserLuck 367 — 8y
0
local by definition means that a players computer handles the physics; so you can never have multiple owners, you can use :SetNetworkOwner(player) to set that player, but if you want complete no lag on all players, have a local script clone the model and put it in each players camera. This will let each player have there own unique copy of it. http://wiki.roblox.com/index.php?title=Local_parts CALEB2020 30 — 8y

Answer this question