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

Any suggestions for smooth, no lag rotation?

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

✓ Accepted answer

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?

1 comment

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.

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)

6 comments

0

Hmmm... ok, I'll give that a try and get back to you.

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.

0

Sorry this couldn't work out.

0

That's fine, thanks for trying though. I'm going to check out the Roblox forums and see what they say about it.

0

You could use RemoteEvents/Function to connect your local script with the server script. BTW I'm back after like 2 months.

0

Why would I use a client for a wait on a server?

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.

2 comments

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?

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

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