I’ve come back to the devforum after a long hiatus for a dilemma rooted in how roblox physics function.
I am currently working on a game where the general gameplay involves being a ball that runs into other balls to knock them off of the edge of an arena. Naturally for the player balls to be able to control themselves the controls, and by proxy the networkownership has to be client-sided. Now the problem
appears because of how roblox handles collision between parts with their two different network owners. I’ve drawn up what exactly the problem is.
The proper physics are applied to the way the clients would expect, but that’s not a great way to allow the game to function.
The two solutions I have attempted are:
- Rewriting movement to be done on server, but you can’t constantly tell the server what your camera cframe is without hacky solutions
- One client the server to tell another client that they collided, and then applying a force to the second client when detected, but this functioned very messily especially when competing with roblox’s physics
I’m at a loss for what I can do to solve this problem, which is why I’m coming to you guys.
This is a very good question! I was experiencing similar problems about a month ago with my vehicle system. When you collide with another client, it takes about .3 seconds for them to get the collision message and then for you to actually see them move. In that .3 seconds, your object has already stopped because it thinks it hit a brick wall.
Unfortunately, there aren’t any easy fixes for something like this. If it’s possible, you could follow these events. Sadly, it does have some downsides:
- Detect that the object is going to collide with another object. There should be about .3 seconds of breathing room before the collision
- Set the object’s network owner to the client who is moving faster
- After a second or few after the collision, set the network owner back to the correct client
The downsides are that for a second or two, one of the clients will lose control over the ball. There will also be a visible stop for the ball while it is changing network owners. This system would also be very complicated for multiple balls in the same collision. I would not recomend doing this.
You could also experiment with using
part:ApplyImpulse(*force*) when the balls collide. This will only solve the problem where
P1 keeps rolling at the same speed after the collision.
P2 will most likely still stop.
I hope that you can find a solution for this problem, and if you can, please let me know or message me, as I am also trying to find a method
I actually tried something similar to the both solutions, I tried temporarily seting both parts’ network owners to the server. I ultimately scrapped it because of how obvious it was and laggy it looked when they would swap. Also the problem with losing control temporarily. The second solution you offered was similar to my second solution, only i directly changed the AssemblyLinearVelocity instead of using a function that I’ve never heard of.
I see, I am glad you got that working!
Unfortunately I didn’t get it working. The problem remains where the custom collisions physics compete with Roblox’s physics. I tried using collisions groups but then the problem arose that, well, the balls wouldn’t collide when not moving or moving slowly.