Got a cannon, attached to a ship which will always be physics owned by the server. This makes the entire thing a mechanism, so I can’t set NetworkOwnership for the cannon separately.
For the cannon to be smoothly controlled, like in many games such as Dead Ahead’s anti air guns, I need it to follow the mouse cursor lagless. Calulating CFrames manually on the client separately is a last resort, how would I do this?
Extra explanation: Currently, I have it so a RemoteEvent ends the direction of the camera which follows the mouse like a first person camera. The server can adjust the hinges on the cannon. replicates to other people,. looks good
But, since the client has to send camera direction to the server, have that processed then have the slow physics replication to catch up for the cannon to “move”, it always lags behind a little behind the mouse cursor.
Predict the position on the client, instead of using the server’s rotation even on the controlling client’s view, just let the client that’s controlling the cannon rotate the cannon immediately to its mouse locally, and let all other clients use the replicated rotation
Thanks for reply, I’m using the HingeConstraint’s motor features to rotate the cannon. And, since the cannon is always owned by the server (I can’t change that due to other connected assemblies)
I can’t get the cannon to rotate separately on the client. I do see a way to do this by just forcing the CFrame, though I made this post to avoid that solution.
Got any solutions to get HingeConstraint to work separately on the client, or some other non-CFrame forcing method?
Not really sure, you could try sending UnreliableRemoteEvents only to the other clients about the rotation every maybe 100 miliseconds and lerp them on the client, like sending 3 u16’s would be 6 bytes and 10 times per second gives it 60 bytes per second of bandwidth (unless you have multiple cannons then you need a way to identify those too, maybe with 8/16bit uints for an ID or if you really don’t care about bandwidth you could just send the instance from the server right away)
This youtuber had a similar issue with lag and a bunch of parts not working as intended, he also used physics based bullets first, but switched to using raycasts and math to calculate the bullets trajectory manually.
This will ofcourse take some work to implement, but it will be much faster and as a plus it will also make the game much smoother and less laggy with a high bullet count.
Just send the rotation to every other client from the server and let them figure the actual cannon rotation out by themselves, and let the controlling client manage it locally with the mouse. Not sure how it’ll work with hinges, never used them