Okay so I have this problem that been bugging me for over a week and I’ve searched and have found some pages with kind of what I need but nothing really solving my problem.
I’m not to knowledgeable when it comes to this stuff but I’m trying to make a little game me and my nephew can play together.
The situation is the players spawn in and the after a few seconds a bunch of “zombies” will spawn in (ignore the explosion).
The players have a dragrigidbody script attached to the camera so that they can pick up the "zombie"and move it around.
It works find from the person hosting it. and the other player can see it(bit laggy) but when the (non host) tries to drag the “zombie” its all jittery and forceful to it’s current position.
Not sure if that has made sense so I have uploaded the project files.
Just build it and check it out for yourself.
Any help would be great because this is my biggest problem so far.
If no one can solve it, what price would I be looking at to hire someone to write it up for me?
I’m basically looking for a ball game where both players can drag the Rigidbody ball.
Even have it where a player can knock the ball or drag the ball away from the other player.
Also have the ability to add force to the ball in direction of which the camera is facing.
alot to ask for i guess.
The same problem bugged me too…i tryed so many things, but on the client, the rigid gameobjects, jitters through the country. pls let me know, if you found a solution, i do it to you, if i found! i promise
This is, what i think too. Only one instance (the server) have to calculate the rigidbody physic. Otherwise, we become this jitter effect. Because every instance want to move the rigidbody with his own physic. Thats my speculation…
But how wie can change this? And how its possible, that wie can manipulate the rigidbody gameobjects from the client side. I mean, we have a function “sync rigidbody” now. I hope that is what we want.
For your problem maybe a solution is, to disable the rigidbody in this time, you move the zombies arround… but i think, this don´t make you happy. and me too…
Ok, now i tested it out! I added with AddComponent a rigidbody on the script, because only the server have to do this (with “if(isServer)”… and then only the transform is synced. The Jittereffect is now eliminated. This is exactly, what i suspected befor. The Jitter is cleared, but the client player don´t can manipulate the rigidbody with the playerprefab. And i know why…the server only become the position of the clientplayer, not the speed and his complete rigidbody values(like the mass). In this reason, thats imposible to calculate the right collisionvalues. I don´t have a easy solution for that.
In my experience the problem with NetworkTransform synchronization is that it only syncs the position/rotation/velocity. This is fine for a spaceship game with no drag. But in most games where there is a lot of drag and the object rapidly decelerates between Network OnSerialization calls then the velocity gets jittery. So in addition to syncing position/rotation/velocity the applied force must be synchronized and applied on all Clients. You must do this manually with a new script.
In other words it doesn’t look like the NetworkTransform combined with Rigidbody physics & drag/friction is functioning without jitters. You need to script your own transform synchronization.
It’s just weird. You’d think there would be an answer somewhere for this.
And it just sucks that on another project I have that isn’t ran through unet both players can collided with a rigid body sphere and it register’s that smoothly with no problem’s. But even then trying to drag a rigid body only works host side. Frustrating that something so small can actually be more technical.
Again I’ll keep searching for an answer and update this post with any information as I think it critical.
Yes do that! I still searching for a nicely solution too. Earlyer in a other engine, i solved the problem, to do the physic´s only on the server, and the clients, only send the moving commands to the server. The server moves the player rigidbody and send only the positions of player and rigidbody´s. You can say, all clients see only a shaddow of the real physicbody´s. But this is a comprehensive and big latency solution. Thats not, what i want again!
Would be great, to know, how i can tell the server, velocity, mass and all these stuff the server need, to calculate, the correct reaction.
“Frustrating that something so small can actually be more technical.” <<< believe me…that´s not so small. But i´m wondering why we have “sync rigidbody” in our network transform component…is it buggy, or (and this i believe) i don´t understand the function.